Difference between doing a Software reset via NVIC and RCC Software Reset Flag

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

Difference between doing a Software reset via NVIC and RCC Software Reset Flag

问题

我正在进行一个项目,在该项目中,如果我插入一个设备,MCU(STM32G0)应该执行软件复位。我不知道应该选择哪种方式来实现软件复位。
我应该简单地调用NVIC系统复位,还是应该使用复位和控制寄存器中的软件复位位?

英文:

I'm working on a Project in which, if I plug in a device, the MCU(STM32G0) should perform a software reset. I do not know which way I should choose, to achieve the software reset.
Should I simply call the NVIC System Reset or should I use the Software Reset Bit in the Reset and Control Register?

答案1

得分: 1

你指的RCC的“软件复位标志”是什么?RCC有一个标志来指示发生了软件复位,它没有一个控制位来执行复位。按照定义,"标志"是一个指示器,而不是一个控制位。

根据参考手册5.1.2节:

软件复位

必须设置Cortex®-M0+应用中断和复位控制寄存器中的SYSRESETREQ位,以在设备上执行软件复位(请参阅编程手册PM0223)。

所以答案很明确,只定义了一种方法。

即使RCC具备这种能力,或者您使用了其他方法,比如强制看门狗超时,NVIC(特别是SYSRESETREQ)是ARM设备中多个供应商的通用/可移植方法,因此它仍然是通用的方法。

英文:

What RCC "Software Reset Flag" are you referring to? The RCC has a flag to indicate that a software reset occurred, it does not have a control bit to effect a reset. A flag is by definition an indicator not a control.

From the reference manual section 5.1.2:

> Software reset
>
> The SYSRESETREQ bit in Cortex®-M0+ Application interrupt and reset control register
must be set to force a software reset on the device (refer to the programming manual
PM0223).

So the answer is clear, there is only one method defined.

Even if the RCC had that ability, or you used some other method such as forcing a watchdog expiry, the NVIC (and specifically SYSRESETREQ) are common across ARM devices from multiple vendors, so it would in any event be the common/portable method.

huangapple
  • 本文由 发表于 2023年7月20日 14:45:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76727306.html
匿名

发表评论

匿名网友

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

确定