A number of skeleton templates for embedded systems

On this page is a number of generic task constructions usefull in embedded systems

The is hold on a generic level but is easy convertable to krnl, FreeRtos, … There are some examples in bewteen written for krnl. You can easily get them up and running.

1. Fixed samplingsfrequency (task synchronized by timed semaphore)

In many systems it is critical to have a rock stable samplingsfrequency for obvious purposes (control, signal processing, …)

  • endless loop where you are wairting by a semaphore which is signalled by the kernel with strict regular intervals

  • if you come to late the signal will be accumulated. Please note limit imposed by max limit set in k_crt_sem

  • Task shall normally be among the higheste prioritized on a preemptive kernel so

  • Task will get the CPU when it is started

  • If you dont have highest task priority you might be delay in execution bq the CPU is taken by some one else.

  • Task can easy check if its behind (there is already a signal waiting at the semaphore when the task enter the wait call in the top of the loop)

  • if behind k_wait returns 1. If we have been waited it returns 0. If timeout (no signal) it returns < 0.