How to Write a Basic Dynamic Tick BSP for μC/OS-III

Time-keeping in μC/OS-III has always been performed by means of a tick interrupt.

There are a number of features in μC/OS-III which require time-keeping services. For example, you may want your task to delay for some amount of time before running again, or wait on a semaphore, but timeout if the semaphore is not available after some time.

Prior to V3.05.00, μC/OS-III supported only Periodic Tick Mode. This is still the most commonly-used mode, and it requires programming a timer only once to interrupt the system at a fixed frequency (usually 1 KHz). We call this frequency the Tick Rate, since every interrupt represents a single tick of system time.

One drawback to using Periodic Tick Mode is that the tick interrupt fires even when there is nothing to wake up. This is unacceptable for low-power applications because it would mean potentially waking the MCU from sleep mode on every tick. Our advice to customers in this situation has heretofore been to disable the tick altogether and to rely only on the other kernel services. In fact, this approach is still valid for low-power applications with no need for timeouts or delays.

However, for applications that need to conserve power without disabling the tick, a different solution had to be developed.

Download and continue reading the full Application Note.

Tags: ,

Questions or Comments?

Have a question or a suggestion for a future article?
Don't hesitate to contact us and let us know!
All comments and ideas are welcome.