Hi, there i'm working on a real time project,i use arduino due it has ARM CORTEX M3.
i use chibios and i find it verry powerful, i have a question about the chconf.h file !!
i want to know the meaning of this line
CH_CFG_ST_FREQUENCY 1000
if i change it to 2000 or 10000 what will happen ??
can anyone explaine me this please
Question about the CH_CFG_ST_FREQUENCY
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Question about the CH_CFG_ST_FREQUENCY
Hi,
It is the resolution of the system time and timeouts. At 1000 the resolution is 1mS.
If you don't have a specific need of a different value then just keep it at 1000.
It does not affect performance.
Giovanni
It is the resolution of the system time and timeouts. At 1000 the resolution is 1mS.
If you don't have a specific need of a different value then just keep it at 1000.
It does not affect performance.
Giovanni
-
jonesrayan
- Posts: 16
- Joined: Sat Oct 01, 2016 5:07 pm
Re: Question about the CH_CFG_ST_FREQUENCY
hI, thanks for the replay. so if i let the value 1000. i cant' do a threadsleepmicroseconde(), i can't do a sleep under 1ms ?? this is what you mean
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Question about the CH_CFG_ST_FREQUENCY
Hi,
All sleep functions approximate the specified time to the next system tick, so even specifying 1uS you would get 1mS if the frequency is 1000.
Note that you should not expect to use the RTOS functions in the uS range, 50uS is the minimum reasonable resolution, any lower and you would get an increasing jitter.
Jitter itself depends on a lot of other things, other threads, critical zones and IRQs mainly.
Giovanni
All sleep functions approximate the specified time to the next system tick, so even specifying 1uS you would get 1mS if the frequency is 1000.
Note that you should not expect to use the RTOS functions in the uS range, 50uS is the minimum reasonable resolution, any lower and you would get an increasing jitter.
Jitter itself depends on a lot of other things, other threads, critical zones and IRQs mainly.
Giovanni
-
jonesrayan
- Posts: 16
- Joined: Sat Oct 01, 2016 5:07 pm
Re: Question about the CH_CFG_ST_FREQUENCY
i don't undersatnd your answer !!. do you mean if i want to do a sleep of 100 microseconde i should change the frequency ?? to 10000.
could you tell me which file do i change to make my system can sleep in a 100 microseconde please
could you tell me which file do i change to make my system can sleep in a 100 microseconde please
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Question about the CH_CFG_ST_FREQUENCY
Hi,
No, by setting the clock to 10000 means that the resolution is 100uS but does not mean that you will get exactly 100uS intervals, for example.
chThdSleepMicroseconds(100)
Would delay you between 0 and 100 microseconds.
chThdSleepMicroseconds(200)
Would delay you between 100 and 200 microseconds and so on.
There is always an uncertainty of one system tick cycle. If you need 100uS intervals then you frequency must be much higher than that, for example 1000000, but you will still have to consider jitter.
What are you trying to do? probably there are other ways.
Giovanni
No, by setting the clock to 10000 means that the resolution is 100uS but does not mean that you will get exactly 100uS intervals, for example.
chThdSleepMicroseconds(100)
Would delay you between 0 and 100 microseconds.
chThdSleepMicroseconds(200)
Would delay you between 100 and 200 microseconds and so on.
There is always an uncertainty of one system tick cycle. If you need 100uS intervals then you frequency must be much higher than that, for example 1000000, but you will still have to consider jitter.
What are you trying to do? probably there are other ways.
Giovanni
-
jonesrayan
- Posts: 16
- Joined: Sat Oct 01, 2016 5:07 pm
Re: Question about the CH_CFG_ST_FREQUENCY
i want to test rtos performance so i need to know the maximum speed of my board.
and what do you mean by the jitter can you give me an example please ?
and what do you mean by the jitter can you give me an example please ?
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Question about the CH_CFG_ST_FREQUENCY
If you need to do measurement look into the time measurement API, it uses a realtime counter and is very accurate.
Note that the test suite includes already a lot of benchmarks, look at reports under /doc/rt/reports, probably your answers are there.
Giovanni
Note that the test suite includes already a lot of benchmarks, look at reports under /doc/rt/reports, probably your answers are there.
Giovanni
-
jonesrayan
- Posts: 16
- Joined: Sat Oct 01, 2016 5:07 pm
Re: Question about the CH_CFG_ST_FREQUENCY
Thanks, my last question, the jitter. could you give me an example how to manipulate jitter on chibios and what danger if we did change please.
i see on wikepedia the definition of the jitter but i didn't understand. also using it in chibios. could you explain me please with example.
many thanks
i see on wikepedia the definition of the jitter but i didn't understand. also using it in chibios. could you explain me please with example.
many thanks
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Question about the CH_CFG_ST_FREQUENCY
Jitter is not something you use, it is a problem.
More here: http://www.chibios.org/dokuwiki/doku.ph ... les:jitter
Giovanni
More here: http://www.chibios.org/dokuwiki/doku.ph ... les:jitter
Giovanni