`machine.reset_cause()` always returns 0 on Arduino Portenta H7 port
Observed on a Portenta H7, running stock 1.19.1 firmware, over a UART repl:
MicroPython v1.19.1 on 2022-06-18; PORTENTA with STM32H747
Type "help()" for more information.
>>> import machine
>>> machine.reset_cause() # have just soft-reset, so should be 0
0
>>> machine.WDT(timeout=1000) # trigger watchdog reset in 1second
<WDT>
>>> MPY: can't mount SD card
MicroPython v1.19.1 on 2022-06-18; PORTENTA with STM32H747
Type "help()" for more information.
>>> import machine
>>> machine.reset_cause() # have just booted after a watchdog reset; should be equal to machine.WDT_RESET
0
>>> machine.WDT_RESET
3
Update: it's an issue with reset_cause() more generally:
No matter what reset is actually done (I've tried soft, hard, and watchdog), machine.reset_cause() always returns 0. Reading stm.mem32[stm.RCC + stm.RCC_RSR] also returns 0, which I think is expected since modmachine.c tells this register to reset (via RCC->RCC_SR |= RCC_SR_RMVF;) but even if I comment out this line and recompile, the RCC_RSR register still always returns 0. Is it possible the bootloader or other core of the H747 is clearing this before micropython has a chance to?
Have tested on 1.19 and 1.20.
`machine.reset_cause()` always returns 0 on Arduino Portenta H7
No matter what reset is actually done (I've tried soft, hard, and watchdog), machine.reset_cause() always returns 0. Reading stm.mem32[stm.RCC + stm.RCC_RSR] also returns 0, which I think is expected since modmachine.c tells this register to reset (via RCC->RCC_SR |= RCC_SR_RMVF;) but even if I comment out this line and recompile, the RCC_RSR register still always returns 0. Is it possible the bootloader or other core of the H747 is clearing this before micropython has a chance to?
Have tested on 1.19 and 1.20.