cancel
Showing results for 
Search instead for 
Did you mean: 

Brown Out Detection

A3
Associate III

I am using STM32F779NI for my project. My use case is I want to detect brown out reset after brownout occurs and system restarts.

I am checking brownout reset flag using

 if (__HAL_RCC_GET_FLAG(RCC_FLAG_BORRST). But the problem is this flag is shared/common between Power On Reset and Brown Out Reset i.e POR/PDR or BOR .

Also for POR/PDR, there is an explicit RCC flag i.e RCC_FLAG_PORRST which is also set at every Power ON. So even though there is no brownout reset i.e normal POR/PDR, both the flags will set. 

Please suggest me the possible ways to detect only brownout reset.

5 REPLIES 5
Jack Peacock_2
Senior III

Either POR or BOR the implication is voltage has dropped below a safe operational level for the STM32 core, so retaining internal flags isn't reliable. Now if you assume POR is a cycle, voltage to 0V then back up to Vdd, but BOR only drops below the BOR threshold, default or option byte setting, then you have a detectable condition. If power is lost, SRAM will lose its contents, but if the BOR stops at a point where SRAM is preserved, then you can detect a POR based on retaining or losing the contents of SRAM. If voltage drops below SRAM retention then there's no real differernce between BOR and POR.

Set the BOR to a threshold above SRAM retention. Write a signature value to a reserved word in SRAM, or several in separate banks. Check if that signature is valid after a reset. If not, POR, otherwise BOR. Don't use SRAM in backup domain if there's a separate Vbat supply.

Jack Peacock

A3
Associate III

Hi @Community member​ 

Thanks for the prompt reply. I will check the SRAM retention voltage and set the BOR threshold accordingly.

Then will check by writing and reading the value from a reserved word in SRAM as you suggested.

Thanks again.

A3
Associate III

How can we get the SRAM retention voltage? I checked the datasheet, it is not mentioned anywhere.

A3
Associate III

@Community member​ Hi,

Are you aware of this?

A3
Associate III

I am using STM32F779NI and Keil IDE. Target SRAM for project defined is starting address 0x20000000 with size 0x80000. Which location should be used for writing this keyword for BOD?