nRF5 SDK with SoftDevice and RTOS

Hi,

I'm setting up the project(VS Code + Make + ARM-GCC) for nRF52840. The project will use nRF5 SDK(not new with Zephyr) and softdevice(both BLE roles).

Until now I've been using CMSIS RTX5 and I like it. I found few topics here on DevZone that RTX is not supported because of interrupts. So, I've been looking for "modified" FreeRTOS in nRF5 SDK v17.1.0 and I cannot find it. Where I can find FreeRTOS that will work with soft device?

The project will not use round robin scheduler, it will use co-operative where each task will switch to next task. No ciritical sections. I would be happy if I can use RTX with coop scheduler.

Thanks.

 

Parents
  • Little update:
    After reading about RTX5 kernel and SoftDevice interrupts - All interrupts are intercepted by SoftDevice.
    If SVC ID is less than 0x10(16) than SVC call is passed to application. RTX5 uses SVC 0 for scheduler, so that will work.

    So, I'm not sure what can cause the problems if RTX5 is used? What is different in nRF FreeRTOS compared to original FreeRTOS? 

  • Little update:

    I've set up little demo with nRF52840 and nRF5 SDK v17.1.0 - device will advertise itself. Everything works without RTX5(5.9.0 with CMSIS RTOS2 API). And almost everything works well with RTX5.

    With RTX5 it starts to advertise and after few minutes(not sure if the period is constant) it just goes to HardFault_Handler.

    I guess that SoftDevice configures SVC interrupt, so I removed "SVC_Setup" from function "svcRtxKernelStart", called from "osKernelStart". After that RTOS works fine and no hard fault.

    Demo has same base - BLE part while RTOS part has two tasks. Both print to RTT and have little(but not same) osDelay. Now, this seems too easy fix, not sure did Nordic team tried this. I need more info how to put SoftDevice on 100%. Seems too easy to be true.

     

  • Other RTOS cannot use SVC when softdevice is enabled. The Nordic SoftDevice (which is a precompiled binary stack) takes over certain system resources, including the SVC interrupt, which it uses for internal operations.If another component (like RTX5) modifies the SVC handler after the SoftDevice is enabled, it can cause a HardFault.

Reply Children
No Data
Related