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

SWI2_IRQHandler causing NRF_ERROR_NO_MEM

I have found that when I try and initial the Softdevice to use the Scheduler, shortly after initialization and right before dm_init() runs, I get an NRF_ERROR_NO_MEM error asserting which is stemming from the SWI2_IRQHandler in softdevice_handler.c (line 306). I have my scheduler queue size set to 30 but the error still persists. There isn't any other code which should generate scheduler events before this occurs except from the SoftDevice. Therefore I must suspect the Softdevice is fill up the queue. I cannot increase the queue size any more as I get RAM overflow errors. So I'm at a bit of a loss to find the root cause of this error. As a temporary work around I no longer use the scheduler with the Softdevice, but I would really like to solve this one. Thanks for the help folks.

DC

  • 30 events - that seems like a lot before anything has even happened, SOC events go through the same handler, but even so, it's a lot. Could put a global variable temporarily in the SWI2 interrupt code and test you get to 31 at the point you crash, prove that's what's happening.

    I think you get the SWI2 interrupt every time there's a new event, which would mean you get many event handlers queued up behind each other, which is a bit daft. Looking at that code seems it would be quite possible to put in a variable to indicate there's already a handler queued and not queue another one, set it when you queue one, reset it at the very start of the handler before it pulls out any events. I don't think there's a race condition there and that would mean that you only ever have one pending softdevice event handler in the queue at one time.

  • Hi RK,

    I tried adding a catch loop and running on a Release version of firmware. It doesn't seem to hit the loop, thus it seemed to be related to running and debugging Debug version of the code. Still unsettling, but seems to be fine now.

    I've still initialize the Stack without the Scheduler now to try and keep the event queue count lower. Trying to track down the bug in my other thread you're helping me with. I supposed I can close this one for now. Thanks for your help RK

    DC

Related