Skip to main content
rwils.1
Associate III
March 5, 2023
Solved

Power on reset (PORRST) not detected on STM32L471RGT6

Hi,

I am trying to detect whether a reset event was caused by power on rather than any other reset such as a button reset or a software reset. I attempted to use

 if (__HAL_RCC_GET_FLAG(RCC_FLAG_PORRST) != RESET)

but the compiler reports that PORRST is not recognized. I tried BORRST and that is recognized but i don't believe that that setting is solely for power on detection.

Thanks in advance

Richard

This topic has been closed for replies.
Piranha
PiranhaBest answer
Principal III
March 11, 2023

Maybe read the reference manual?

The device has an integrated power-on reset (POR) / power-down reset (PDR), coupled with a brown-out reset (BOR) circuitry. The BOR is active in all power modes except Shutdown mode, and cannot be disabled.

During power-on, the BOR keeps the device under reset until the supply voltage VDD reaches the specified VBORx threshold.

Therefore at least for these devices POR=BOR and it sets BORRSTF. And in addition the PINRSTF will always be set.

7 replies

waclawek.jan
Super User
March 5, 2023

Try using normal register access and symbols from the CMSIS-mandated device header.

JW

rwils.1
rwils.1Author
Associate III
March 8, 2023

Thank you Jan, I'm not sure not sure where to find that device header.

Regards

Richard

waclawek.jan
Super User
March 8, 2023

Hi Richard,

I meant https://raw.githubusercontent.com/STMicroelectronics/STM32CubeL4/master/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l471xx.h and you have it under a similar path at your computer...

...but I spoke too soon: unlike some other STM32, the 'L4xx appears to have no PORRST flag in RCC_CSR:

0693W00000aIWTyQAO.pngMaybe POR is indicated by absence of any other flags being set in that register, but that needs some testing.

JW

rwils.1
rwils.1Author
Associate III
March 9, 2023

Thank you Jan, much appreciated.

Piranha
PiranhaBest answer
Principal III
March 11, 2023

Maybe read the reference manual?

The device has an integrated power-on reset (POR) / power-down reset (PDR), coupled with a brown-out reset (BOR) circuitry. The BOR is active in all power modes except Shutdown mode, and cannot be disabled.

During power-on, the BOR keeps the device under reset until the supply voltage VDD reaches the specified VBORx threshold.

Therefore at least for these devices POR=BOR and it sets BORRSTF. And in addition the PINRSTF will always be set.

rwils.1
rwils.1Author
Associate III
March 12, 2023

Thanks!