How do I debug resets?
I'm using a Kinetis KL17 with FreeRTOS.
My code keeps resetting itself, according to the registers this is because of a watchdog reset, in the RCM registers SRS0 and SRS1 only the WDOG bit is set. However I've don't have the Watchdog enabled, so it can't be a watchdog that's causing this reset (COPT in SIM_COPC is set to 00). So any suggestions on how I can track down what's actually causing the reset?
My suspicion is that it's something to do with power modes. When I'm in the idle task I go into a low power mode dependant on what perpipharals are acticve. In summary:
- If either I2C or UART2 are active go into VLPW
- Otherwise go into VLPS
This code keeps reseting itself.
If I remove the UART2 case statement, this works fine, i.e.
- If I2C is active go into VLPW
- Otherwise go into VLPS
However if I always go into VLPW no matter what's enabled - then this causes resets.
Although it's importnat to note that none of these resets occour the moment sleep is exited or entered.