nRF52_Arduino FreeRTOS Multithreading Model
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

nRF52_Arduino FreeRTOS Multithreading Model

by ajcamill on Tue Aug 11, 2020 3:59 pm

I was trying to find a way to implement a worker thread on the Feather nRF52840 Sense, and came across this thread. It talked about a "freeRTOS specific tutorial page". Has that tutorial page ever been created? If so, where is it located? I've looked for it and can't seem to find it.

An overview of the system I am creating consists of 2 nrf52 feather sense boards, with 1 in bridge mode, connecting both boards to a mobile device. Data will be collected from the sensors on both boards and sent as data packs to the mobile device. There will also be different events, such as buttons triggering interrupts, timers, etc., and module controllers in the system. I think it would be best to go fully tickless for the system and I am planning on doing that.

I plan to create a worker thread that will handle the data retrieval and transmission, and possibly a separate thread for BLE communication to the mobile device (From what I understand, I believe a thread is already created for this). How would I go about implementing a worker thread into the API? It was touched on a little on a Github issue #165, but am a little confused on how to go about implementing it.

I have a brief understanding of how freeRTOS works, with experience in threading. I have seen the example code for using the APIs scheduler. Though this could work, but I would like full control of starting and deleting threads.

Posts: 1
Joined: Tue Aug 11, 2020 2:55 pm

Re: nRF52_Arduino FreeRTOS Multithreading Model

by hathach on Sun Sep 06, 2020 3:44 am

There is already a worker thread called AdaCallback, you can use the macro here to schedule a function
https://github.com/adafruit/Adafruit_nR ... back.h#L93

The usage can be a bit advanced with malloc on the fly, but easy to use once familiar. It is used widely within the bsp/library, you could search for its usage.

Posts: 1137
Joined: Tue Apr 23, 2013 1:02 am

Please be positive and constructive with your questions and comments.