lowering system tick or timer ISR

zvonko69 wrote on Tuesday, May 11, 2010:


atmega32, 8 mhz clock, 1 ms system tick (default)

i need to service an event every 800 microseconds ( display refreshing sort of event)

what would u guys recommend, separate timer ISR for this or maybe lowering the system tick
value to 800 microseconds ?


richard_damon wrote on Tuesday, May 11, 2010:

The first question comes on the details of the 800 microsecond “display refresh”. Is this needing to be synchronized to the display? (If so, just changing the timer isn’t apt to be sufficient). Is this for an access delay? (note that to get an accurate "at least 800 microsecond’ delay, an 800 microsecond timer is not good).

If this is the only thing that needs this level of timing, (especially if it doesn’t need it all the time), to set up a dedicated interrupt for this timing and level the system tick alone (or maybe even slow it down).

As to my comment on the system timer not being good for delays with a minimum requirement, the issue is that a vTaskDelay(1) will delay to the next tick, not for a full period of a tick, that says the task will be put back on the ready list anywhere from 0 microseconds (if it make the call just before the timer tick) to a full timer tick period (if it calls just after). Thus the shorted guaranteed delay is a vTaskdelay(2) which will for sure delay 1 tick, and up to 2 ticks (more if a higher priority task is running).  If you really want accurate 800 microsecond delays, you need to use a dedicated timer in a one shot mode that you trigger when you need it and wait for a semaphore, that the interrupt will raise when the time is up. 

zvonko69 wrote on Tuesday, May 11, 2010:

im not sure i understand, i.e. the last sentence is a bit confusing, where would you wait for a semaphore ?

its a small array of LEDS, 8 rows x 23 columns, each row is refreshed every 800 microseconds, i.e. each row is turned on
for approx. 800 microseconds, if i exceed this timing , screen flickering can be seen, i mean it does not have to be exactly
800 microseconds ,  100 microseconds up or down could be tolerated, this would only affect brightness of leds

how would you approach to this example with 1 ms system tick and 8 Mhz clock,
what is a good value for system tick anyway , the default is 1 ms in atmega32 port that is why i mention it

the data for the whole array is stored in array variable in RAM