Multitasking and event handling

Mclennon gravatar image

asked 2017-11-18 20:21:08 +0100

updated 2017-11-21 15:11:03 +0100

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.



edit retag flag offensive close delete report spam



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.

Dave_couling ( 2017-11-18 21:42:14 +0100 )editconvert to answer

1 answer

Sort by » oldest newest most voted
hungbui gravatar image

answered 2017-11-20 16:33:41 +0100

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.

edit flag offensive delete publish link more


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.

Roger ( 2017-11-21 14:54:02 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2017-11-18 20:21:08 +0100

Seen: 59 times

Last updated: nov. 21