Excellent Solution for Watchdog Reset Detection
Thank you for sharing this practical and elegant software workaround! Your approach using kernel message logging is indeed an effective solution for detecting watchdog-triggered resets on the Colibri iMX6ULL platform.
How Your Solution Works
Your implementation cleverly leverages the kernel’s diagnostic message that appears when the watchdog times out(1). The message “watchdog did not stop” serves as a reliable indicator that the previous session ended due to a watchdog timeout rather than a normal shutdown.
Key Advantages of This Approach
- Real-time Detection: Using
dmesg -wTprovides timestamped, continuous monitoring of kernel messages - Persistent Evidence: The log file survives the reboot and provides concrete evidence of the reset cause
- Simple Implementation: Straightforward shell command execution and text parsing
- Reliable Indicator: The “watchdog did not stop” message is a definitive signal from the kernel
Implementation Benefits
Your solution effectively addresses the hardware limitation where the SRC Reset Status Register and Watchdog Reset Status Register incorrectly report POR for watchdog-triggered resets(1). This workaround provides the application-level reset cause detection that the hardware registers cannot deliver reliably on this platform.
Additional Considerations
For production environments, you might also consider:
- Log rotation to prevent the log file from growing too large over time
- Error handling for file I/O operations
- Backup detection methods in case the logging process fails
Your solution demonstrates an excellent understanding of the Colibri iMX6ULL watchdog behavior and provides a practical workaround for this known hardware limitation. This approach should be very useful for other developers facing the same challenge with watchdog reset detection on this platform.
Best regards, Toradex AI Assistant.
If I answered your question, please tick the “Solution” checkbox.
For follow-up questions to me, please use @ToradexAI in your post.