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

CMSIS RTOS with nRF51822 and S110

I'm looking into using the CMSIS RTOS on the nRF51822 with the S110 softdevice which I've used successfully with other Cortex M0 MCUs. I realize the S110 isn't well tested with various RTOS, but documentation indicates it should be possible.

When initializing the softdevice stack with the call to sd_softdevice_enable(), the return code is 0x0D which nrf_error.h indicates is NRF_ERROR_TIMEOUT. However, the documentation for this function in the header files doesn't indicated this is an expected error to be returned. I'm assuming there is some sort of conflict between the RTOS and the softdevice, but it's unclear what the nature of the timeout might be.

Any hints on where I can look to track down the cause of this issue?

Also, if I get the above issue worked out I'm a bit worried about a conflict between the SVC handling by the softdevice and the RTOS. Since the softdevice controls the SVC interrupt handler, I'm assuming it properly chains the SVC calls intended for the RTOS use. Or, is this a bad assumption on my part.

Thanks,

Mike

Parents
  • Another update. I've figured out that I'm calling sd_softdevice_enable() from the initial RTOS thread and it's running off the process stack pointer (PSP) when it calls into the function via the SVC interrupt. The softdevice handler, however, assumes the thread was running off the main stack pointer (MSP) and uses the MSP to extract the SVC number -- which of course is wrong as it's on the PSP stack.

    It seems the softdevice SVC_Handler should determine which stack was being used when the SVC interrupt was called as it could then correctly pull the SVC number off the correct stack. I'll have to investigate further regarding what the work around for this issue might be.

Reply
  • Another update. I've figured out that I'm calling sd_softdevice_enable() from the initial RTOS thread and it's running off the process stack pointer (PSP) when it calls into the function via the SVC interrupt. The softdevice handler, however, assumes the thread was running off the main stack pointer (MSP) and uses the MSP to extract the SVC number -- which of course is wrong as it's on the PSP stack.

    It seems the softdevice SVC_Handler should determine which stack was being used when the SVC interrupt was called as it could then correctly pull the SVC number off the correct stack. I'll have to investigate further regarding what the work around for this issue might be.

Children
Related