扩展睡眠模式禁用/重新启用

学到更多FAQsTutorials

13个帖子/ 0新
Last post
adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
扩展睡眠模式禁用/重新启用

Hi,

一世'm trying to get extended sleep working on my custom board with the DA14581 MOD board. The setup is as follows:

系统最初配置使用Extended_sleep,而无需OTP副本。唤醒在按钮中断时配置,首先按下系统唤醒系统。在唤醒时,禁用睡眠(使用Arch_disable_sleep),因此我可以使用Timer0每100ms对传感器进行排样。然后,Extended_sleep将在7秒后重新启用。

After a defined period of time(~3-4 seconds), the system seems to just decide it should go back into extended_sleep, eventhough it was never re-enabled, and according to arch_get_sleep_mode the sleep mode is off (0). Of course then the timer0 is no longer running, so the sensor is no longer being sampled.

如果我配置系统以不使用Extended_sleep,那么一切都按预期工作。同样,当耗尽RAM(使用Keil Debug)时,使用Extended_sleep的此系统工作正常,但不使用闪存时。

Do you have any idea what is causing this?

谢谢

设备:
adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
我设置了默认值

我设置了默认值_operation_adv = NULL, rather than user_app_adv_start as all the other examples did. Once its put back to user_app_adv_start then it works fine in the flash while the advertising is running. If I wait until the advertising is complete to press the button then it again does the freezing. Based on the current consumption when it freezes, it looks like its not actually in extended_sleep mode, and actually still in active mode, just stuck somewhere.

你有什么想法是否为什么?从我的角度来看,所有这些都改变了它在开始时的广告,但它似乎影响不仅仅是那样的。

PM_Dialog
Offline
Last seen:16 hours 28 min ago
Staff
Joined:2018-02-08 11:03
Hi AdamShier,

Hi AdamShier,

谢谢for your question online and for your interest in our TINY module solution, Let me change the device selection for your initial post, as the DA14581 is selected instead of the DA14531 TINY Module.

如果我的理解是错误的当筹码唤醒时,可以请注明它是否也开始广告?你打电话给user_app_adv_start()回调吗?

>>>在定义的时间段(〜3-4秒)后,系统似乎只是决定它应该重新进入Extende_sleep,事件从未重新启用

So, if you are booting from System-RAM, can you wake it up after a GPIO trigger after the device decides to sleep?

Can you please check if a timer causes the “automatic” sleep? Which SDK project are you using as a reference to develop your own application?

>>>基于当前消耗它冻结时,看起来它实际上不是在Extended_sleep模式下,实际上仍然处于活动模式,只是粘在某个地方。

是否有可能以调试模式运行它,并检查代码是否已破坏到断言,NMI等?

一世f the default_operation_adv = user_app_adv_start, then the DA4531 will start advertising automatically after the system initialization.

谢谢, PM_Dialog

adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
The module is configured in

该模块在ext_sleep_mode中配置withoutOTP copy, user_app_init is used as the .app_on_init, and the wakeup controller is configured to use a GPIO as the wakeup from the button. When the chip wakes up it does not start advertising, because I have purposedly removed that aspect. The user_app_adv_start() callback is only called when someone holds the button for 10 seconds.

我可以使用GPIO触发器从睡眠中唤醒它。一旦它醒来,除非是启用广告,否则将在3-4秒后冻结,除非是广告,在这种情况下,一切都将正常工作。

The problem with running in debug mode is that everything works fine in debug mode, but not when running from the flash.

一世understand the aspect of default_operation_adv = user_app_adv_start automatically starting the advertising at the beginning. Im just not sure why that seems to change the behavior of the code in terms of getting frozen after the defined period, versus working as expected.

就它类似的基本项目而言,它将是睡眠模式的User_Peripheral one和代理一个的组合。

adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
The code also works fine if I

The code also works fine if I use the app_easy_timer() instead of setting up the timer0 as the counter. I know the timer0 is disabled in extended sleep mode but im using arch_disable_sleep() upon wakeup from the button so I dont see why that would be a problem.

在从按钮唤醒时,定时器完全重新初始化/配置,因此它似乎是正确的,但在一段时间后,代码只是停止。

Edit: This time from button wakeup until freeze is 2.7 seconds, very consistently. And its definately not sleeping, the run current goes up from 200uA to 300uA when the freeze occurs.

PM_Dialog
Offline
Last seen:16 hours 28 min ago
Staff
Joined:2018-02-08 11:03
Hi AdamShier,

Hi AdamShier,

您是对的 - 当设备睡眠时,Timer0已关闭,作为所有外围设备。您可以使用app_easy_timer()定期唤醒,因为它是使用BLE定时器。您可以检查设备是否在广告间隔之间睡觉?一世

>>>The problem with running in debug mode is that everything works fine in debug mode, but not when running from the flash.

随附调试器时,会阻止系统进入任何睡眠模式。

Could you please clarify what you mean that the device getting frozen after the defined period?

由于您从Flash启动,您可以使用ARCH_PRINTF()以便在串行终端中打印一些调试信息。

谢谢, PM_Dialog

adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
使用闪光灯启动时,

当使用闪光灯启动时,当我没有按下按钮或在广告中占用时,设备肯定会睡觉,睡眠电流下降到〜10ua。

我正在使用printf,以确定它被冻结。按下按钮后,禁用睡眠状态,并启动Timer0并每100ms生成中断。所有中断处理程序都已打印递增索引。递增索引工作2.7秒,直到它只是停止,这就是我知道它在2.7秒后始终冻结。

adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
这是或多或少地得到解决。

这是或多或少地得到解决。一世don't exactly know why it was freezing after the 2.7 seconds, or why it was working when advertising is enabled, but it works properly now when I've removed the

if(arch_ble_ext_wakeup_get()))in the button press callback. I think it's in the example projects because the button starts the advertising, and it only evaluates true when the advertising is complete. So for my project it makes sense for it to not be there.

PM_Dialog
Offline
Last seen:16 hours 28 min ago
Staff
Joined:2018-02-08 11:03
Hi AdamShier,

Hi AdamShier,

默认情况下,WDOG超时左右2.6秒,所以我假设WDOD定时器到期。

您是否始终连接调试器?您还应该具有启用的开发调试 - CFG_DEVELVELMMENT_DEBUG。

谢谢, PM_Dialog

adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
WDOG未定义

WDOG未在配置文件中定义,但那些时间似乎太接近是巧合。定义了CFG_DEVELINMENT_DEBUG。从Flash运行时出现此问题,并发生调试器是否已连接。

PM_Dialog
Offline
Last seen:16 hours 28 min ago
Staff
Joined:2018-02-08 11:03
Hi AdamShier,

Hi AdamShier,

您能否在调试模式下定义WDOG并运行它?如果在正常模式下从系统RAM运行它(没有安装调试器),您是否可以复制此行为?随附调试器时,这会阻止系统睡眠状态。

谢谢, PM_Dialog

adamshier
Offline
Last seen:3 weeks 3 days ago
Joined:2020-07-30 18:04
So I tried enabling the

So I tried enabling the watchdog and that seems to solve it also, rather than removing the check on the arch_ble_ext_wakeup_get in the wakeup callback. I'll summarize the combinations here for people:

如果你有

if(arch_ble_ext_wakeup_get()))
{
ARCH_BLE_FORCE_WAKEUP();
arch_ble_ext_wakeup_off();
app_easy_wakeup();
}

And you want to disable sleep for some period, then re-enable sleep at some later point, then the watchdog must be enabled. Otherwise after waking the code will freeze after the watchdog timeout, still not sure why exactly. There's also the case when advertising is enabled then it will work while the device is advertising, then will freeze again when finished, therefore with infinite advertising you dont see this problem.

PM_Dialog
Offline
Last seen:16 hours 28 min ago
Staff
Joined:2018-02-08 11:03
Hi AdamShier,

Hi AdamShier,

谢谢你的迹象,很高兴你有工作。

谢谢, PM_Dialog