打印

STR912长时间睡眠无法唤醒?

[复制链接]
2912|18
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
whredmaple|  楼主 | 2009-11-27 14:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
STR912长时间睡眠无法唤醒?有谁碰到过这个问题,怎么解决的?
沙发
vigia| | 2009-11-27 16:28 | 只看该作者
STR9的sleep模式有个limitation,在errata sheet中有详细说明和workaround,看看是不是和你的问题有关?

使用特权

评论回复
板凳
秋天落叶| | 2009-11-28 09:55 | 只看该作者
没碰到过,很想知道怎么解决,2楼的方法可行不

使用特权

评论回复
地板
whredmaple|  楼主 | 2009-12-2 22:00 | 只看该作者
看datasheet的说法:
After the CPU enters sleep mode, it can be woken up by:
1. External interrupt
2. RTC/USB interrupt
3. External reset
When an oscillator chip is used as the clock source for the STR91xFA, the CPU wakes up
from sleep mode following any of the above three input events. If a crystal is used as the
clock source, the crystal is disabled in sleep mode to save power consumption. When a
wakeup event occurs, the crystal does not recover fast enough and the CPU hangs.
Workarounds
Workaround solutions include:
1. Use the 32 kHz RTC clock as the clock source for sleep mode:
a) Select the RTC clock as the CPU clock source prior entering sleep mode.
b) The CPU wakes up following any of the three wakeup events and waits for the
crystal to start oscillation. A crystal startup time is about 1.5 ms typical.
c) After the crystal wakes up, the CPU waits for a tWAIT time before the first code is
fetched from Flash memory. The software can then change the CPU clock source
back to the OSC or PLL clock. The duration of tWAIT depends on the crystal
frequency. tWAIT equals 50 µs at 25 MHz and 312 µs at 4 MHz.
2. Instead of a crystal, use an oscillator as STR91xFA clock source.
This limitation will not be fixed in future silicon revisions

使用特权

评论回复
5
whredmaple|  楼主 | 2009-12-2 22:13 | 只看该作者
1.我采用一个25Mhz的oscillator 代替crystal,发现系统还是经常发生不能唤醒

2.设置内部clkfMSTR=fRTC=32.768 kHz, fRCLK=32.768 kHz
fFMICLK=fHCLK=fPCLK=32.768 kHz,
这种办法,仍然不能100%唤醒,
我设置方法: 每次进入待机前设置clk函数 SysClkRTCConfig(),中断后回调 SysClkConfig()函数,还有什么我没有考虑全的?

void SysClkConfig(void)
{

    SCU_MCLKSourceConfig(SCU_MCLK_OSC);
                                                     // Set the PLL's multipliers and dividers         
    SCU_PLLFactorsConfig(BSP_PLL_N, BSP_PLL_M, BSP_PLL_P);
    SCU_PLLCmd(ENABLE);                              // Enable the PLL                                 
    SCU_RCLKDivisorConfig(SCU_RCLK_Div1);            // Set RCLK, the CPU clock's main divider         
    SCU_PCLKDivisorConfig(SCU_PCLK_Div1);            // Set APBDIV, the PCLK divider                  
    SCU_FMICLKDivisorConfig(SCU_FMICLK_Div2);

    SCU_MCLKSourceConfig(SCU_MCLK_PLL);              // Select the PLL output as CPU clock            

}

void SysClkRTCConfig(void)
{
    //SCU_MCLKSourceConfig(SCU_MCLK_RTC);
                                                     // Set the PLL's multipliers and dividers         
   // SCU_PLLFactorsConfig(BSP_PLL_N, BSP_PLL_M, BSP_PLL_P);
    SCU_PLLCmd(DISABLE);                              // Enable the PLL            
    SCU_MCLKSourceConfig(SCU_MCLK_RTC);
       
    SCU_RCLKDivisorConfig(SCU_RCLK_Div1);            // Set RCLK, the CPU clock's main divider ,RClk=Fmstr  
    SCU_PCLKDivisorConfig(SCU_PCLK_Div1);            // Set APBDIV, the PCLK divider                  
    SCU_FMICLKDivisorConfig(SCU_FMICLK_Div1);
       
    SCU_MCLKSourceConfig(SCU_MCLK_RTC);
    //SCU_MCLKSourceConfig(SCU_MCLK_PLL);              // Select the PLL output as CPU clock     

}

使用特权

评论回复
6
whredmaple|  楼主 | 2009-12-3 17:11 | 只看该作者
版主能不能帮忙分析一下,现在产品正在批量,测试出这些问题.比较急!!!

使用特权

评论回复
7
sinadz| | 2009-12-4 09:00 | 只看该作者
看来楼主真的是比较急

使用特权

评论回复
8
vigia| | 2009-12-4 09:49 | 只看该作者
看看erratasheet的2.10.1和2.10.2,以前有客户有类似的问题,都是在进入sleep模式时出的问题。

具体说说你怎么进的sleep模式,和怎么唤醒的?

使用特权

评论回复
9
whredmaple|  楼主 | 2009-12-5 22:08 | 只看该作者
每次准备sleep,调用以下函数
void LPMode_Sleep_ExternalWakeUP_Interrupt_LVD_OFF_PWD_OFF(void)
{
  /*External wake up interrupt configuration on EXINT2 line 16 */
  //ExternalWakeUP_Interrupt_Config();
  
  /*Flash Config */
  FMI_Config(FMI_READ_WAIT_STATE_1, FMI_WRITE_WAIT_STATE_0, FMI_PWD_DISABLE,\
             FMI_LVD_DISABLE, FMI_FREQ_LOW); /* FMI Waite States */
  
  /*The system clock source switched to the RTC clock */  
   SCU_MCLKSourceConfig(SCU_MCLK_RTC);  /* this line is used when a crystal is
                                        connected to the CPU crystal inputs*/
  /*Enter Sleep mode*/  
  SCU_EnterSleepMode();
  /*Dummy instructions*/
  asm_func_Sleep();
  /*Switch to oscillator as clock source after wake up*/
SCU_MCLKSourceConfig(SCU_MCLK_OSC);  
//  Clock_Source(PLL_Clk66);
}

void asm_func_Sleep(void)
{
   __asm( "NOP\n");
   __asm( "NOP\n");
   __asm( "NOP\n");
}

//中断初识化
void PowerSetupVIC_Configuration(void)
{
  WIU_InitTypeDef WIU_InitStructure;
GPIO_InitTypeDef  GPIO_InitStructure;
  /* Enable VIC clock */
  SCU_AHBPeriphClockConfig(__VIC,ENABLE);
  //VIC_DeInit();
  /* Enable WIU clock */
  SCU_APBPeriphClockConfig(__WIU, ENABLE);
  //WIU_DeInit();


     GPIO_StructInit(&GPIO_InitStructure);
     GPIO_InitStructure.GPIO_Direction = GPIO_PinInput;
     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
     GPIO_Init (GPIO5, &GPIO_InitStructure);//RF_INT
     
  /* 多中断响应 */
//Power_key_detect & System_Lock key
//   WIU_ClearITPendingBit(WIU_Line10 );

   WIU_ClearITPendingBit(WIU_Line11 );
   WIU_InitStructure.WIU_Mode = WIU_Mode_WakeUpInterrupt ;
   WIU_InitStructure.WIU_Line = WIU_Line11 ;
   WIU_InitStructure.WIU_TriggerEdge = WIU_FallingEdge ;
   WIU_Init(&WIU_InitStructure);   



   
   /* Configure the External interrupt group 3 priority */
    VIC_Config(EXTIT1_ITLine, VIC_IRQ, 0);
    /* Enable the External interrupt group 3 */
    VIC_ITCmd(EXTIT1_ITLine, ENABLE);                 
       
  /*Configures External interrupt as WakeUp line*/
   SCU_WakeUpLineConfig(11);

}         


中断在别的函数里面设置了,现在问题是他休眠了,就唤不醒.

使用特权

评论回复
10
whredmaple|  楼主 | 2009-12-5 22:29 | 只看该作者
我系统中断响应正常,RTC时钟输出也对的
就是 sleep了,他就不能wake up,

使用特权

评论回复
11
zwll| | 2009-12-6 00:18 | 只看该作者
;P楼主不要着急啊

使用特权

评论回复
12
whredmaple|  楼主 | 2009-12-6 09:20 | 只看该作者
这个问题是这样的,绝大部分机器都是可以正常唤醒的,现在就是100台中测试有3台不能正常唤醒.[url][/url]

使用特权

评论回复
13
pkat| | 2009-12-7 10:55 | 只看该作者
能理解楼主的心情

使用特权

评论回复
14
whredmaple|  楼主 | 2009-12-7 16:21 | 只看该作者
一群幸灾乐祸的人呀
我现在正在测试,实在不行,就不让他sleep好了,把时钟打到32.768Khz,连续开机2天,电量还很足!
不过我目前待机电流有6mA,正常工作电流119mA,有些偏大!后面再继续测试优化!

使用特权

评论回复
15
香水城| | 2009-12-7 20:09 | 只看该作者
这个问题是这样的,绝大部分机器都是可以正常唤醒的,现在就是100台中测试有3台不能正常唤醒.
whredmaple 发表于 2009-12-6 09:20


楼主是否能说说你的产品的工作环境,在系统处于休眠状态时电源上是否有干扰?供电电压是否有波动?另外,MCU处于Sleep时,你的系统中的其他电路处在什么状态?MCU的所有I/O引脚处于什么状态?

一般这种多数情况正常,而少数情况下有问题的现象,可以在系统受到干扰方面找找原因。

使用特权

评论回复
16
whredmaple|  楼主 | 2009-12-8 23:54 | 只看该作者
香水城:

     目前产品就是处于生产车间,没有特意加一些干扰,扰动测试.供电为2000mAH@3.7V Li-电池,供电为Regulator 3.3V,1.8V两颗. 在待机状态时,部分I/O为High或者Low.
现在挑出20台机器连续测试2周,发现就是部分偶尔会出现不能唤醒

使用特权

评论回复
17
whredmaple|  楼主 | 2009-12-8 23:58 | 只看该作者
我想知道我现在按照上面的方法做,是不是还有什么问题没有考虑周全?

使用特权

评论回复
18
vigia| | 2009-12-9 09:54 | 只看该作者
LZ我发你的短消息看了没?

使用特权

评论回复
19
whredmaple|  楼主 | 2009-12-14 10:18 | 只看该作者
谢谢vigia
修改后,现在这个问题没有再重现了.

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

22

主题

69

帖子

0

粉丝