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:
This code keeps reseting itself.
If I remove the UART2 case statement, this works fine, i.e.
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.
Solved! Go to Solution.
Hi Ben,
Please check this register description in the KL17 reference manual:
You can find, after reset, COPT is not 0, it means, the watchdog is enabled automatically after reset, if you don't want to use it, you need to disable it in your code after power on.
I think in your code, you didn't disable the watchdog, then you also didn't feed the dog, so you will have the watchdog reset.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Got it sorted now.
The solution was:
So there must be something that changes with the watchdog clocking when going into VLPW mode.
Hi Ben,
Please check this register description in the KL17 reference manual:
You can find, after reset, COPT is not 0, it means, the watchdog is enabled automatically after reset, if you don't want to use it, you need to disable it in your code after power on.
I think in your code, you didn't disable the watchdog, then you also didn't feed the dog, so you will have the watchdog reset.
Wish it helps you!
Have a great day,
Kerry
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------