This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Multitasking and event handling

Hello Everyone,

It is unclear to me how a soft-device operates regarding multi-tasking and event-handling. I'm assuming Nordic engineers have their own real-time operating system in place for their soft-devices whereby tasks and events are executed based on some form of scheduling algorithm.

For an application, if one want to run multiple loops (tasks) at the same time, would starting the RTC timer and then running timer handlers at the desired sampling time constitute the best way to run multiple tasks in parallel? If so, are there any limitations on how many tasks one can run using the RTC? Lastly, is there a way to create one's own priority triggered event-handler, as opposed to continuous polling?

I'm also thinking towards using FreeRTOS to address the questions above, but at the moment not sure..., I appreciate any comments.

Best,

Roger

  • I'd highly recommend using the freeRTOS framework. Its very well vetted and supported by the community. So debugging issues will be made a bit easier.

  • Hi Roger,

    I don't think we implement any multi tasking or real time OS inside our softdevice. It's basically a RTC timer and a scheduler working together. One task finishes before the other, no preemption.

    For your application, what kind of limit you are thinking of ? I assume you are planning to do cooperative multitasking ?

    I agree with Dave, freeRTOS would suit your need.

  • At the moment, I would like to run two tasks at the same time, both sampling at approximately 1 kHz. My application is quite small, one loop will be reading in IMU sensor measurements and updating a filter algorithm. The other loop will run the control algorithm. I need some codeblocks to execute when some events occur. I will also need to log data on an external SD as close as possible to real-time. Later on, I would like to read and write the data from a tablet to control and monitor the system. There might be additional tasks and events added on at a later stage. As you rightly point out, for multitasking, preemption will be necessary.

    Quite new to FreeRTOS and looking forward to using it.

    Thanks Dave and Hung for your comments.

Related