2021-12-20 07:54 AM
I have a project that was working at one point but is no longer working. I think I've narrowed the issue down to a couple of flash operations that happen during setup for Azure IOT. If I let the system run normally it will keep resetting and not run. If I go into a debug session I can step through the entire IOT setup process and it will run fine. If I step to just before the IOT setup begins it and then let it run it fails.
2021-12-20 08:41 AM
Read the RCC_CSR bits to determine the cause of the reset. Use GPIO pins or other means of conveying information in order to determine where in the code problems occur.
2021-12-20 01:52 PM
It does seem to be caused by the watchdog timer and I had a feeling that was what causes it but what seems strange is that it happens much faster than the watchdog timeout time and only when I am trying to do a Flash operation outside of stepping through it with the debugger.
2021-12-20 03:13 PM
If it really happens much faster than it should, then watchdog configuration could be failing to set the correct divider. If that is OK, then check the FLASH latency setting and the erase/write code.
2021-12-20 04:39 PM
The watchdog is governed by an internal hardware state machine. It's exceedingly unlikely that it is misbehaving. It's more likely that your code does not refresh it when you think it does or that it is not configured as you assume. It's also possible that your method of determining how fast it resets is flawed, perhaps because the CPU is blocked due to an ongoing flash operation.