← index #11186Issue #11392
Duplicate · high · value 3.738
QUERY · ISSUE

`machine.reset_cause()` always returns 0 on Arduino Portenta H7 port

openby victorallumeopened 2023-04-04updated 2025-09-05
bug

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.

CANDIDATE · ISSUE

`machine.reset_cause()` always returns 0 on Arduino Portenta H7

closedby victorallumeopened 2023-05-01updated 2023-05-02
bug

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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied