微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > 关于获取休眠唤醒源函数MAP_PRCMHibernateWakeupCauseGet

关于获取休眠唤醒源函数MAP_PRCMHibernateWakeupCauseGet

时间:10-02 整理:3721RD 点击:

Hi, 大家好,

最近在用CC3200做项目,其中涉及到进入休眠,1、通过GPIO唤醒,2通过RTC唤醒(实现系统自复位功能)

进入休眠之前已经设置了唤醒源,例如GPIO唤醒

void EnterHIBernate()
{
#define SLOW_CLK_FREQ (32*1024)
//
// Configure the HIB module RTC wake time
//
MAP_PRCMHibernateIntervalSet(5 * SLOW_CLK_FREQ);

//
// Enable the HIB RTC
//
MAP_PRCMHibernateWakeupSourceEnable(PRCM_HIB_LOW_LEVEL|PRCM_HIB_GPIO4|PRCM_HIB_GPIO13);//power key and charge key


DBG_PRINT("HIB: Entering HIBernate...\n\r");
MAP_UtilsDelay(80000);

//
// powering down SPI Flash to save power
//
Utils_SpiFlashDeepPowerDown();
//
// Enter HIBernate mode
//
MAP_PRCMHibernateEnter();
}

通过RTC唤醒,以便实现系统复位功能

void RebootMCU(void)
{
//
// Configure hibernate RTC wakeup
//
PRCMHibernateWakeupSourceEnable(PRCM_HIB_SLOW_CLK_CTR);
//
// Delay loop
//
MAP_UtilsDelay(800000);
//
// Set wake up time
//
PRCMHibernateIntervalSet(330);

Report("\r\n-------RebootMCU------\r\n");
//
// Enter HIBernate mode
//
MAP_PRCMHibernateEnter();
}

但当唤醒后调用MAP_PRCMHibernateWakeupCauseGet 获取唤醒源,该函数返回零,得不到正确的结果

正确的结果应该返回PRCM_HIB_WAKEUP_CAUSE_SLOW_CLOCK或PRCM_HIB_WAKEUP_CAUSE_GPIO

why?

what happened

参考例程sensor_profile吧,里面有参考。

这个例程解决不了我上述的问题

程序里面当进行OTA升级时,进入休眠前需要设置成RTC唤醒,其目的是实现软复位的功能

其它情况下进入休眠前,需要设置为GPIO唤醒,目的是通过外部按键唤醒,进而运行程序

我需要通过PRCMHibernateWakeupCauseGet();  获取到唤醒源;但获取到的结果为0  而不是期望的PRCM_HIB_WAKEUP_CAUSE_GPIO 或PRCM_HIB_WAKEUP_CAUSE_SLOW_CLOCK

why?

what happened?

下面是进入main的代码

void main()
{
long lRetVal = -1;
unsigned long rlt;
//
// Board Initialization
//
BoardInit();
//
// configure the GPIO pins for LEDs,UART
//
PinMuxConfig();

GPIO_IF_NormalConfigure();
KeyInit();
//
// Configure the UART
//
#ifndef NOTERM
InitTerm();
#endif //NOTERM

rlt = PRCMHibernateWakeupCauseGet();
DBG_PRINT("MAP_PRCMHibernateWakeupCauseGet = %d\n\r",rlt);

if(MAP_PRCMSysResetCauseGet() == PRCM_HIB_EXIT){
DBG_PRINT("wake up from Hibernate\n\r");
if(rlt == PRCM_HIB_WAKEUP_CAUSE_GPIO){
DBG_PRINT("gpio wake up from Hibernate\n\r");
MAP_UtilsDelay((60*80*1000)); //60ms
MAP_UtilsDelay((60*80*1000));
if(GPIO_IF_Get(DM_KEY_1,g_uiKey1Port,g_ucKey1Pin) == 1){
EnterHIBernate();//1 second delay
}
MAP_UtilsDelay((30*80*1000));
MAP_UtilsDelay((30*80*1000));
if(GPIO_IF_Get(DM_KEY_1,g_uiKey1Port,g_ucKey1Pin) == 1){
EnterHIBernate();
}
MAP_UtilsDelay((30*80*1000));
MAP_UtilsDelay((30*80*1000));
if(GPIO_IF_Get(DM_KEY_1,g_uiKey1Port,g_ucKey1Pin) == 1){
EnterHIBernate();
}
}else if(rlt == PRCM_HIB_WAKEUP_CAUSE_SLOW_CLOCK){
DBG_PRINT("rtc wake up from Hibernate\n\r");
}

请大家协助解决

谢谢!

这是TI的一个硬件bug,

参考如下方法,看是否有帮助:

This is a limitation in our current silicon and there are no direct ways of getting the wakeup cause from HIBernation.

Please consider if you could use some indirect means of determining the wake source depending on your usecase. For instance, the elapsed duration in HIBernation can be approximately determined by saving the last SlowClockCount and deducting it from the current value after the wakeup. If this is close to the value set as HIBernate duration, the source can be Slow clock wakeup.

参考:https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/493920

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top