STM32复位事件处理

huangapple go评论50阅读模式
英文:

STM32 reset events handling

问题

有没有办法在STM32L0xx的复位引脚上生成下降和上升事件?理念是在快速按下时执行正常的硬件复位,而在长时间按下时加载出厂设置。谢谢!

英文:

Is there a way to generate falling and rising events on the reset pin of STM32L0xx?
The idea is to do a regular hw reset it when quick pressed when pressed and hold to load the factory settings.
Thank you!

答案1

得分: 1

以下是您要翻译的内容:

  1. "The falling edge 'event' is that your software stops running and all the volatile registers (apart from in the backup domain) return to their default value."

    • "下降沿 '事件' 是指您的软件停止运行,所有易失性寄存器(备份域除外)返回到它们的默认值。"
  2. "DRAM may also be corrupted but SRAM should retain its contents as long as power is not interrupted."

    • "DRAM 可能会受到损坏,但只要电源没有中断,SRAM 应该保留其内容。"
  3. "The rising edge 'event' is that your software starts running again from the reset handler function in the interrupt vector."

    • "上升沿 '事件' 是指您的软件再次从中断向量中的复位处理程序函数开始运行。"
  4. "If you want to time how long the reset was, then you need a clock that carries on counting through the reset. The RTC meets this requirement."

    • "如果您想计时复位持续多长时间,那么您需要一个时钟,在复位期间继续计数。RTC 满足此要求。"
  5. "You can read the value of the RTC at startup, and compare it to the value it had before reset."

    • "您可以在启动时读取RTC的值,并将其与复位前的值进行比较。"
  6. "The hard part is how to know after reset what the value of the RTC was before reset, when the reset clears or corrupts various memory and comes when you aren't expecting it."

    • "困难的部分是在复位后如何确定复位前RTC的值,当复位清除或损坏各种内存并在您没有预期的情况下发生时。"
  7. "One approach would be that while your application is running, you copy the RTC clock value to the RTC backup registers on a regular basis, for example from the SysTick interrupt. The backup registers behave just like normal RAM except that they retain their value when the main regulator is turned off. This means the value in them after reset will be the RTC value of the last time the systick interrupt ran before the reset."

    • "一种方法是,当您的应用程序正在运行时,定期将RTC时钟值复制到RTC备份寄存器中,例如从SysTick中断。备份寄存器的行为与普通RAM相同,除了在主稳压器关闭时它们会保留其值。这意味着在复位后,它们中的值将是复位之前systick中断上次运行时的RTC值。"
英文:

The falling edge "event" is that your software stops running and all the volatile registers (apart from in the backup domain) return to their default value. DRAM may also be corrupted but SRAM should retain its contents as long as power is not interrupted.

The rising edge "event" is that your software starts running again from the reset handler function in the interrupt vector.

If you want to time how long the reset was, then you need a clock that carries on counting through the reset. The RTC meets this requirement.

You can read the value of the RTC at startup, and compare it to the value it had before reset.

The hard part is how to know after reset what the value of the RTC was before reset, when the reset clears or corrupts various memory and comes when you aren't expecting it.

One approach would be that while your application is running, you copy the RTC clock value to the RTC backup registers on a regular basis, for example from the SysTick interrupt. The backup registers behave just like normal RAM except that they retain their value when the main regulator is turned off. This means the value in them after reset will be the RTC value of the last time the systick interrupt ran before the reset.

答案2

得分: 0

重置引脚没有任何“事件”。你不能这样做。

英文:

The reset pin does not have any "events". You cant do it.

huangapple
  • 本文由 发表于 2023年3月31日 19:40:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/75898124.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定