现象描述
stm32使用 NVIC_SystemReset()函数软件重启失败
解决方法
找到NVIC_SystemReset()的定义,继续跳转至 __NVIC_SystemReset函数,将其中的 SCB_AIRCR_SYSRESETREQ_Msk 修改为 SCB_AIRCR_VECTRESET_Msk 即可。
__NO_RETURN __STATIC_INLINE void __NVIC_SystemReset(void)
{
__DSB(); /* Ensure all outstanding memory accesses included
buffered write are completed before reset */
SCB->AIRCR = (uint32_t)((0x5FAUL << SCB_AIRCR_VECTKEY_Pos) |
(SCB->AIRCR & SCB_AIRCR_PRIGROUP_Msk) |
SCB_AIRCR_SYSRESETREQ_Msk ); /* Keep priority group unchanged */
__DSB(); /* Ensure completion of memory access */
for(;;) /* wait until reset */
{
__NOP();
}
}
标签:__,NVIC,AIRCR,重启,SCB,STM32,Msk,软件,SystemReset From: https://www.cnblogs.com/wfagly/p/18218986