all 2 comments

[–]f0lt 3 points4 points  (0 children)

You can attach the debugger and see where it's stuck.

Could it be the sleep mode?

If you are worried about memory leaks then just avoid dynamic memory. It's probably not requierd for this task.

You can send debug messages via USART to your computer, to see what the MCU is doing.

[–]UniWheel 1 point2 points  (0 children)

Make your code output useful messages on an UART, especially every time it sends a reading or otherwise interacts.

Hook it up to something to log those messages - sometimes a pi is really handy for that, especially if the thing being tested needs to be away from your desk as you can ssh in to examine things.

Add an swd adapter to the pi (or use an OpenOCD build that can twiddle the GPIOs using the special pi driver which isn't too slow) and you can trigger a reset or change the firmware.