3
\$\begingroup\$

The STM32F4 MCU has a brownout reset feature. According to the manual, section 5.2.2, when the supply voltage VDD drops below the selected VBOR threshould, a device reset is generated. After reset, I can check the BORRSTF flag in register RCC_CSR (see section 6.3.21 of the manual) to see whether the reset was due to a brownout.

I'd like to simulate this behavior in the STM32F100, which lacks a brownout reset feature. My idea is to use the programmable voltage detector (section 4.2.2 in the manual) to generate an interrupt in EXTI line 16. When the interrupt handler is called, I'll generate a software reset; I can verify, after reset, that the reason was a software reset by way of the SFTRSTF flag in register RCC_CSR (see section 6.3.10 of the manual). Since I don't generate a software reset anywhere else in my code, I can be certain it was due to a brownout.

Here's what I'm looking to know:

  • Can anyone see a flaw in this idea?
  • Would an actual brownout wipe the SFTRSTF flag in question?
\$\endgroup\$
3
\$\begingroup\$

I see no major flaw in this design, but consider few limitations:

  • as this is software based brownout reset (not configured in option bytes), it will not work until your code configures it (so voltage drop just after power up will be undetected),
  • as it uses interrupt it will not work if interrupt with higher or equal interrupt priority is already executing.

As far is I know reset flags must be cleared manually (at least in F4), so:

  • brownout will not wipe software reset flag,
  • you must clear this flag on startup, otherwise after other reset you can have multiple flags.
|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.