cancel
Showing results for 
Search instead for 
Did you mean: 

Power on reset (PORRST) not detected on STM32L471RGT6

rwils.1
Associate III

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

1 ACCEPTED SOLUTION

Accepted Solutions
Piranha
Chief II

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.

View solution in original post

7 REPLIES 7

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

JW

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

Regards

Richard

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

Thank you Jan, much appreciated.

Piranha
Chief II

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.

Thanks!

This explains it, indeed.

This is indeed different from e.g. 'F4 where BOR and POR are two different thing and BOR even can be switched off.

Another opportunity to write one of the dozens of appnotes per module. There are so many subtle but important reset-related issues - e.g. these variants of reset in different families, the reset-disable feature in 'F2/'F4, the reset output and how loading it prevents software/watchdog resets, etc. - we see here being brought up regularly.

JW