Runtime errors hang controller even after power restart #12161
-
|
I am programming an RP2040. If during the course of operating the program, it encounters some sort of error, sometimes the micro hangs, even after a hard restart or even a power off. The only way to recover is to boot into bootloader mode, mount as USB, unmount, and restart. Then the program runs normally. There are no errors in startup, and the fact that going into bootloader mode fixes things, makes me believe there is some sort of persistent state that is only reset when mounting as a USB drive. Am I correct? What is the best way to deal with this situation? This project will be in an industrial product, so going into a persistent wacky state would be a major problem. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
|
Unless you're reflashing when you mount as USB (aka BOOTSEL mode on the RP2040), it shouldn't affect flash state for subsequent reboots. Could the code be affecting Code that runs at startup, then fails after a while may likely have a subtle runtime error. How's your memory allocation? If you're networked, are you closing all requests you open? Are you using threads? Not that threads are inherently unsafe, but they add complexity that can pull the rug from under you in many unexpected ways. Again, those shouldn't cause unrecoverable errors. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Thanks so much for the suggestions. While I haven't tried another board, I do know there aren't any power sags. I am using rshell, so that rules out the IDE, and no to using sleep mode.
I do believe I may have found the cause though. Since originally posting, I have experienced more state issues where for example, the serial device wouldn't post to my USB connection. When I pulled the power for just a second or two, it still wouldn't post. When I pulled the power for several seconds, everything was restored to normal. So either there is an expiration time for enumerating USB devices in Linux or there is some residual energy in the capacitors or power supplies on my board that continue to …