some porblem with sleep mode

Learn MoreFAQsTutorials

5个帖子/ 0新
Last post
2455321262
Offline
Last seen:2 years 3 months ago
加入:2017-01-22 06:43
some porblem with sleep mode

亲爱的TechnicalSupport,
我使用我们自己的custom board,and when I try make it into external sleep mode ,I have some prblem.
当它从外部睡眠唤醒时,我的主板遵循代码:
if ((DEVELOPMENT_DEBUG) && (USE_POWER_OPTIMIZATIONS))
{
slp_period_retained = slp_period;
// if this Assertion hits then the LP ISR lasts longer than the time
// that has been reserved via LP_ISR_TIME_XTAL32_CYCLES and LP_ISR_TIME_USEC.
if (sleep_lp_cycles && (sleep_lp_cycles < slp_period))
{
ASSERT_WARNING(0); //(it entered here)
}
}
I don't know why it will get here,is it my interrupt function taking up too much time?
I commented out the macro of DEVELOPMENT_DEBUG to jump out. It looks like no problem,I do not know if I'm right .
when the system run after once wakeup ,it can't Triggered interrupt.(it is an external interrupt from one GPIO Pin),At the same time my serial interrupt can not triggered.
could you give me some advice?

Thanks Jerry

Device:
MT_dialog
Offline
Last seen:18 hours 26 min ago
Staff
加入:2015-06-08 11:34
Hi Jerry,

Hi Jerry,

Have you altered the BLE_WAKEUP_LP_Handler at all or delaying the wake up of the BLE by disabling the interrupts? If you get there it means that you spend too much time sleeping and you wont be able to wake up on time, so the SDK is warning you about this. This can also occur if the 580 is active (no BLE core active) with the interrupts disabled and its time for BLE core to wake up, so at some point when its time for the LP_Handler to execute since the interrupts are disabled the ISR delays execution (at some point the interrupts are enabled but the the Handler isn't executed on time), that means that the device was sleeping longer than the time defined and the ASSERTION will occur. If you remove the assertion you will loose events and that could an issue if the device is connected since it could easily drop the connection.

Thanks MT_dialog

2455321262
Offline
Last seen:2 years 3 months ago
加入:2017-01-22 06:43
亲爱的mt_dialog,

Hi MT_dialog,

Thanks for your reply.
I'm sure I have not made any changes with BLE_WAKEUP_LP_Handler and did not delay the wake up for the BLE(the code is basd on Routines of DSPS,If it does not operate on the two points mentioned above )
I am not very able to understand your description.Is it mean my device sleep to much time?And it will affect my ISR? In my understanding, the kernel timer overflow will trigger an interrupt,I set a timer as a system time base.So,it will waked up every 1 second,i don't think it is a long with sleeping .How can i solve this problem?
Another problem is with the ISR.Is BLE_WAKEUP_LE_Handler function be used after the global interrupt enabled ?Why did it can not use other interrupt or it can not execute ISR?(Or because of the sleep time is too long?)
I feel very confused.

Thanks Jerry

MT_dialog
Offline
Last seen:18 hours 26 min ago
Staff
加入:2015-06-08 11:34
Hi Jerry,

Hi Jerry,

本质上意味着LP_Hanlder花了太多时间来执行和警告,您得到的意味着它需要更多时间才能唤醒计算的值。Sleep_LP_CYCLES是编程睡眠量,在BLE核心睡眠前,SLP_PERIOD是当最终时测量的实际睡眠,所以如果实际睡眠大于编程,那么我们有一个问题(丢失的BLE事件)。

The SDK when it comes to BLE works like this, the device calculates the sleep amount, and in that sleep amount the BLE_LP_Handler should be triggered, now if for any reason the LP_Handler delays execution the actual sleep period will be longer than the calculated one and than means that the device wont wake up in time in order to serve the BLE event. What you see doesn't have to do with the kernel timer or how much you instruct the device to sleep.

Regarding how can you solve the problem, as i ve mentioned above this kind of behaviour is seen while the device is awake and the interrupts are disabled but the
BLE core is sleeping, so if its time for the wakeup of the BLE core the LP_Handler wont execute at that time, not until the interrupts are re-enabled so the device
will miss the BLE event since the BLE core didn't woke up in time. So please check if you manually disable the interrupts in any part of your code.

I dont quite get the last question, so will explain how the wake up occurs, when the device falls to sleep it stays in a WFI() with the interrupts disabled (that means that the interrupts will occur but the handlers wont be invoked), so in a BLE_LP interrupt the M0 will wake up and the first command that it will execute is to enable the interrupts, so to serve the LP_Handler.

Also before checking anything of the above please try this and check if this works for you Set the LDO_RET_TRIM of the BANDGAP_REG to value 9 just before the device enters the while loop.

Thanks MT_dialog

2455321262
Offline
Last seen:2 years 3 months ago
加入:2017-01-22 06:43
HI MT_dialog,

HI MT_dialog,
I have solved my problem.Thanks for your help.
assert_warning警告的第一个问题(0);在我把IIC设备放在Periph_init()的文件中,也许iic运行花费到很多时间,它会产生一些prober m.now,我设置了一个标志和init iiC devie in while循环,它可以正常工作。
Another problem of the isr ,that was what i did not do some of the correct settings, I found and solved them.
Thanks again for your help.