This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2640R2F 可能判断启动方式吗

Expert 2290 points
Other Parts Discussed in Thread: CC2640R2F

CC2640R2F是否可以判断是上电启动或是硬件复位启动或软件复位启动?

  • 判断复位原因可用如下方式:

    1、数据手册:

    AON_SYSCTL:RESETCTL.RESET_SRC

    2、driverlib

    //*****************************************************************************
    //
    //! \brief OBSOLETE: Get the last known reset source of the system.
    //!
    //! Recommend using function \ref SysCtrlResetSourceGet() instead of this one.
    //! This function returns reset source but does not cover if waking up from shutdown.
    //! This function can be seen as a subset of function \ref SysCtrlResetSourceGet()
    //! and will be removed in a future release.
    //!
    //! \return Returns one of the known reset values.
    //! The possible reset sources are:
    //! - \ref PWRCTRL_RST_POWER_ON
    //! - \ref PWRCTRL_RST_PIN
    //! - \ref PWRCTRL_RST_VDDS_BOD
    //! - \ref PWRCTRL_RST_VDD_BOD
    //! - \ref PWRCTRL_RST_VDDR_BOD
    //! - \ref PWRCTRL_RST_CLK_LOSS
    //! - \ref PWRCTRL_RST_SW_PIN
    //! - \ref PWRCTRL_RST_WARM
    //!
    //! \sa \ref SysCtrlResetSourceGet()
    //
    //*****************************************************************************
    __STATIC_INLINE uint32_t
    PowerCtrlResetSourceGet(void)
    {
    //
    // Get the reset source.
    //
    return (( HWREG( AON_SYSCTL_BASE + AON_SYSCTL_O_RESETCTL ) &
    AON_SYSCTL_RESETCTL_RESET_SRC_M ) >>
    AON_SYSCTL_RESETCTL_RESET_SRC_S ) ;
    }
  • HAL_SYSTEM_RESET();属于什么复位方式
  • 我記得是PWRCTRL_RST_WARM,你試試就可以確認
  • PowerCtrlResetSourceGet()这个函数返回的是PWRCTRL_RST_POWER_ON, SysCtrlResetSourceGet()这个才是返回PWRCTRL_RST_WARM
  • 感謝反饋