Hi,
I'm trying to get extended sleep working on my custom board with the DA14581 MOD board. The setup is as follows:
系统最初配置为无OTP拷贝的扩展\u睡眠。唤醒是在一个按钮中断上配置的,它在第一次按下时唤醒系统。在唤醒时,睡眠被禁用(使用arch\u disable\u sleep),因此我可以使用计时器0每100ms采样一个传感器。延长睡眠时间意味着在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.
如果我将系统配置为不使用扩展睡眠,那么一切都按预期工作。同样,这个带有扩展睡眠的系统在运行RAM(使用KEIL debug)时工作正常,但在使用flash时工作不正常。
Do you have any idea what is causing this?
谢谢
设备:
我设置了默认值_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.
你知道为什么会这样吗?从我的角度来看,所有这些都改变了,一开始是广告,而不是没有,但它似乎影响的不仅仅是这个。
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.
如果我的理解有误,请更正:模块配置为EXT Sleep mode,在系统初始化时使用OTP copy-user\u app\u init()callback-唤醒控制器也已启用,以便通过GPIO触发器唤醒系统。当芯片启动时,你能指出它是否也开始做广告吗?是否调用用户\u app \u adv \u start()回调?
>>>在一段规定的时间(约3-4秒)之后,系统似乎决定应该重新进入长时间睡眠,即使它从未重新启用
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?
>>>根据它冻结时的电流消耗情况,它看起来实际上并没有处于延长睡眠模式,实际上仍然处于活动模式,只是卡在了某个地方。
有没有可能在调试模式下运行它,并检查代码是否会中断为断言、NMI等。?
If the default_operation_adv = user_app_adv_start, then the DA4531 will start advertising automatically after the system initialization.
谢谢, PM_Dialog
模块配置为ext\ U sleep\ U模式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.
I 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.
就一个与之类似的基本项目而言,它将是用户/外围设备项目和睡眠模式的代理项目的组合。
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.
Hi AdamShier,
你说得对–当设备处于睡眠状态时,定时器0关闭,因为所有外围设备都会阻塞。您可以使用app\u easy\u 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\u printf()在串行终端中打印一些调试信息。
谢谢, PM_Dialog
当使用flash启动时,设备肯定会进入睡眠状态当我没有按下按钮或在广告之间时,睡眠电流会下降到~10uA。
我使用printf来确定它是否冻结了。当按下该按钮时,睡眠被禁用,计时器0被启动并每100ms生成一个中断。中断处理程序所做的只是打印一个递增索引。递增索引工作2.7秒,直到它停止,这就是为什么我知道它在2.7秒后会一直冻结。
这是或多或少地得到解决。I 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\u ble\u ext\u wakeup\u 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.
Hi AdamShier,
默认情况下,WDOG超时大约为2.6秒,因此我假设WDOD计时器将过期。
你运行的是附加了调试器的吗?您还应该启用开发调试-CFG\u development\u debug。
谢谢, PM_Dialog
配置文件中没有定义wdog,但是这些时间似乎太接近了,不可能是巧合。定义了CFG\u DEVELOPMENT\u DEBUG。问题发生在从flash运行时,无论是否附加了调试器都会发生。
Hi AdamShier,
你能定义WDOG并在调试模式下运行它吗?如果您在正常模式下从系统RAM运行它(没有附加调试器),您能复制这个行为吗?连接调试器时,这会阻止系统进入睡眠状态。
谢谢, PM_Dialog
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\u ble\u ext\u wakeup\u get())
{
拱力唤醒();
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.
Hi AdamShier,
谢谢你的指示,很高兴你能成功。
谢谢, PM_Dialog