How to debug an SOS panic? B5som

I've got fairly regular SOS panic of hard fault and I'm using the Particle Debugger with B5som dev kit. I'm unable to catch anything in the debugger or serial monitor via the USB port. The debugger only reports Info : [nrf52.cpu] external reset detected.

Should I expect to be able to get more from the debugger?
Or am I doing something wrong?

I've updated the debugger to latest firmware, running latest CLI and workbench.
I can debug by setting break points.

Thanks

Mark

It's been a while since I've done it, but if I recall correctly, I set a breakpoint in panic_ (services/src/panic.c in the Device OS source). Then, when you hit that breakpoint, check the call stack.

Hi and welcome to the community!

How much memory is your device using?

can you try using this out of memory handler to see if the device is running out of memory?

Are you using the String class or anything that uses it? Can there be a memory leak in your code if using pointers, char arrays or the like?

SOS Panics are... hard to troubleshoot.
Hope you find the culprit soon!
Gustavo.

Thanks for the suggestions both great, will give them a try. Thanks for the quick response.

I'd already thought about out of memory, so setup a handler for that already but haven't tried it yet.

I was 30k over the firmware size limit but have saved about 80k off the code base since then, so I think around 50k at boot.

From your words, I read that this is the size of the firmware, or the space it takes in the flash memory of the device.
As I re-learned today (here), that is different from the RAM your program uses. So the memory handler will help you identify if that is an issue.
Cheers

I wasn't far off, around 50k at boot going down to 40k after cloud connected. Not changing throughout my test.

Setting breakpoint in panic_ highlighted the panic was BusFault, I was tracking a Serial1 corruption (missing data) issue as well. It appears as though I was starving the CPU by running processing code on every byte received on the serial port causing both issues.

Thanks for the help.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.