亲爱的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
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
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
Hi Jerry,
从本质上说,这意味着LP\u handler花了太多的时间来执行,而您得到的警告意味着BLE core花了更多的时间来唤醒计算出的值。sleep\u lp\u cycles是ble核心睡眠前的编程睡眠量,slp\u 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
HI MT_dialog,
I have solved my problem.Thanks for your help.
ASSERT\u warning(0)警告的第一个问题;在我把IIC设备的Init放在periph\u Init()的函数中之前,可能IIC操作花费了很多时间,这会产生一些问题。现在,我在while循环中设置了一个标志并初始化IIC设备,它可以正常工作。
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.