Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

FreeRTOS BLE architecture questions - SDK 14.0.0

Hi All,

I have a general question about the FreeRTOS implementation for SDK 14.0.0.

I've added FreeRTOS onto a basic UART BLE peripheral example that I wrote.  I referenced the HRS FreeRTOS example that comes with the SDK in order to add FreeRTOS to my example.  The code seems to be working and I can connect and communicate with my device as before once I migrated some things to FreeRTOS (eg. nrf_sdh_freertos_init()).

I have some general architecture questions though:

  • From my understanding, the soft device gets put into its own task.  However, what about the service handlers or any of the BLE/advertising handlers which normally reside in functions defined in the main.c file? Are these technically running on the soft device thread/task as well?

  • Prior to using FreeRTOS, I would set a flag in, say, the UART service handler once data was received, and this was processed in the while loop in main.  If I am now using FreeRTOS I know I'll need to move that processing code over to a separate task.  However, does this mean that the flags set in my BLE handlers need to be put into semaphores now so that my processing task can access the flag?  Or keep the flag as a global variable but use mutexes to access them?

If there is any documentation detailing this a bit more, please let me know!  Thanks!

Related