[原创] Cortex-m0 软件复位方法

qiuhaomiao   2012-4-2 16:52 楼主

uint32_t *AIRCR = (uint32_t *)0xE000ED0C;

 

*AIRCR = (0x000005FA<<16)|(1<<2);

  • QQ截图20120402165314.png

回复评论 (1)

回复 楼主 qiuhaomiao 的帖子

谢谢分享。如果要使用软件复位,其实不管是M0,还是M3,ARM公司已经写好了,在core_cmx.h文件中:

 

  1. /** \brief  System Reset

  2.     This function initiate a system reset request to reset the MCU.
     */
    static __INLINE void NVIC_SystemReset(void)
    {
      __DSB();                                                     /* Ensure all outstanding memory accesses included
                                                                      buffered write are completed before reset */             
      SCB->AIRCR  = ((0x5FA << SCB_AIRCR_VECTKEY_Pos)      |
                     SCB_AIRCR_SYSRESETREQ_Msk);
      __DSB();                                                     /* Ensure completion of memory access */             
      while(1);                                                    /* wait until reset */
    }

我的博客
点赞  2012-4-5 13:31
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复