application: add reset cause output
This commit is contained in:
parent
68bdfee641
commit
28ddcc8f6a
|
@ -328,6 +328,32 @@ void main(void)
|
||||||
usb_cdcacm_setup(); // setup USB CDC ACM (for printing)
|
usb_cdcacm_setup(); // setup USB CDC ACM (for printing)
|
||||||
printf("\nwelcome to the CuVoodoo STM32F1 example application\n"); // print welcome message
|
printf("\nwelcome to the CuVoodoo STM32F1 example application\n"); // print welcome message
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
// show reset cause
|
||||||
|
if (RCC_CSR & (RCC_CSR_LPWRRSTF | RCC_CSR_WWDGRSTF | RCC_CSR_IWDGRSTF | RCC_CSR_SFTRSTF | RCC_CSR_PORRSTF | RCC_CSR_PINRSTF)) {
|
||||||
|
puts("reset cause(s):");
|
||||||
|
if (RCC_CSR & RCC_CSR_LPWRRSTF) {
|
||||||
|
puts(" low-power");
|
||||||
|
}
|
||||||
|
if (RCC_CSR & RCC_CSR_WWDGRSTF) {
|
||||||
|
puts(" window-watchdog");
|
||||||
|
}
|
||||||
|
if (RCC_CSR & RCC_CSR_IWDGRSTF) {
|
||||||
|
puts(" independent-watchdog");
|
||||||
|
}
|
||||||
|
if (RCC_CSR & RCC_CSR_SFTRSTF) {
|
||||||
|
puts(" software");
|
||||||
|
}
|
||||||
|
if (RCC_CSR & RCC_CSR_PORRSTF) {
|
||||||
|
puts(" POR/PDR");
|
||||||
|
}
|
||||||
|
if (RCC_CSR & RCC_CSR_PINRSTF) {
|
||||||
|
puts(" pin");
|
||||||
|
}
|
||||||
|
putc('\n');
|
||||||
|
RCC_CSR |= RCC_CSR_RMVF; // clear reset flags
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if !(DEBUG)
|
#if !(DEBUG)
|
||||||
// show watchdog information
|
// show watchdog information
|
||||||
printf("setup watchdog: %.2fs", WATCHDOG_PERIOD / 1000.0);
|
printf("setup watchdog: %.2fs", WATCHDOG_PERIOD / 1000.0);
|
||||||
|
|
Loading…
Reference in New Issue