How to program for deep sleep with BLE timer waking up

⚠️
嗨,...感谢您来论坛。令人兴奋的消息!我们现在正在迁至我们的新论坛平台,将提供更好的功能,并包含在主对话框网站中。所有帖子和帐户都已迁移。我们现在只接受新论坛上的流量 - 请发布任何新线程https://www.dialog-seminile.com/support.。我们将在未来几天修复错误/优化搜索和标记。
12个帖子/ 0新
最后一篇
xuguizhong
离线
最后一次露面:2 years 11 months ago
加入:2017-06-30 02:46
How to program for deep sleep with BLE timer waking up

Base on SDK 5.0.3, For making DA14580 into extend sleep with BLE timer waking up, it is no problem for me now.
但是我必须用醒来的定时器使DA14580变成深睡眠。当然固件被烧成OTP。

Base on project of extend sleep with BLE timer waking up, I have changed it to deep sleep followed the document "Training_04_sleep_modes_current_measurement_v1.0".
然后将其烧成OTP。我发现DA14580可以在BLE定时器后从深睡眠中醒来。

你能给我一个演示让我醒来深深的睡眠吗?(不要用钥匙扣醒来的深睡眠)

谢谢

Device:
mt_dialog.
离线
最后一次露面:2个月1周前
职员
加入:2015-06-08 11:34
嗨徐开忠,

嗨徐开忠,

使用BLE_APP_SLEEP模式,请检查以下更改,以便在深度睡眠模式下运行并通过计时器唤醒:

  • In the user_app_adv_undirect_complete function replace the interrupt initialization with the timer set up.
    • app_sleep_timer_used = app_easy_timer(1000,user_app_adv_start);
  • 计时器应在保留的内存设置中,如下所示:
    • timer_hnd app_sleep_timer_used __attribute__((section("retention_mem_area0"),zero_init)); // @RETENTION MEMORY
  • undefine the CFG_DEVELOPMENT_DEBUG in order for the 580 to switch of the sysram when in deep sleep.
  • 在OTP中刻录您的应用程序。
  • Burn the OTP Header with the Application Flags set to "Yes"

在上面之后,你应该好好去。

Thanks MT_dialog

xuguizhong
离线
最后一次露面:2 years 11 months ago
加入:2017-06-30 02:46
Hi MT_dialog

Hi MT_dialog

Thanks for your feedback.

My software is base on project ble_app_barebone of SDK 5.0.3, using RCX.
我发现它在“user_app_adv_start”函数中创建了一个计时器。
此计时器已在保留存储器中定义。
it is OK, right?

我的问题:
In my exiting software, it can go into deep sleep(the current can show 800nA in Mutimeter).
And it also can wake up after BLE timer (say, 1 second) (monitor current by oscilloscope).
But, after wake up it can`t success to keep running. no advertisement, no sleep again.
保持更高的电流,比如一下600 UA。
Of course, if everything confirmed, I will burn one more to testing.
could you confirm if I have to transplant my software to SDK 5.0.4 from 5.0.3?

void user_app_adv_start(void)
{
//安排下一个广告数据更新
app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb);
......
}
void user_app_adv_undirect_complete(uint8_t status)
{
// If advertising was canceled then update advertising data and start advertising again
if(status == gap_err_canceled)
{
user_app_adv_start();
}
}

mt_dialog.
离线
最后一次露面:2个月1周前
职员
加入:2015-06-08 11:34
嗨徐开忠,

嗨徐开忠,

如果设备成功进入睡眠模式e time (you see about 800nA in multimeter) and then you see that in the next wake up the power consumption is about 600uA that means that the device resets, so i suppose that the 580 enters either an NMI_Handler or a Hardfault Handler. I dont think that this is something related with the SDK that you are using, you will have to check where the device ends up and what causes that reset (check if you can replicate that under development mode with deep sleep, you wont see the desired power consumption since the sysram stays on but if you can replicate that under development mode you can track what causes the issue more easy). From the code that you ve pasted i dont see anything wrong although i am not able to see where the device goes in permanent sleep, the adv_data_update_timer_cb() will cancel the advertising and the user_app_adv_undirect_complete() that will be triggered immidiatelly after that it will restart the advertising.

Thanks MT_dialog

xuguizhong
离线
最后一次露面:2 years 11 months ago
加入:2017-06-30 02:46
Hi MT_dialog ,

Hi MT_dialog ,

我已经测试了深度睡眠,一切都在运行良好。
And I add some testing port in function "adv_data_update_timer_cb()", "user_app_adv_start()" and "user_app_adv_undirect_complete()". It runs OK in development mode.

After burn it into OTP, running with checking testing port,
确认在深度睡眠后无法从OTP复制固件。
could you give me some clue ?
In software,
#define cfg_lp_clk lp_clk_rcx20
And in OTP header, what influences is "0X47F70 Package Used"?

谢谢

mt_dialog.
离线
最后一次露面:2个月1周前
职员
加入:2015-06-08 11:34
嗨徐努利,

嗨徐努利,

您是否将应用程序标志设置为OTP标题中的“是”,以便首次引导程序要知道OTP中有FW?

The #define that you have set is to define the low power clock that your device is going to use, if you are under buck configuration then the RCX20 oscilator is a valid option and you can use it, the field that you are refering (Package Used) is allready burned and identifies the kind of package of the current 580.

Thanks MT_dialog

xuguizhong
离线
最后一次露面:2 years 11 months ago
加入:2017-06-30 02:46
Hi MT_dialog ,

Hi MT_dialog ,

Of course, I set the application flags to "Yes" in the OTP header.
除了深度睡眠醒来之外,什么都可以正常工作。

I have tried any ways to do it. But fail.
你能给我发一位演示项目,带有醒来的睡眠(不是按钮醒来)吗?
Then I burned it into OTP for a testing.

谢谢

mt_dialog.
离线
最后一次露面:2个月1周前
职员
加入:2015-06-08 11:34
嗨徐开忠,

嗨徐开忠,

附加了App_ble_sleepMode的修改版本,使用计时器以及OTP的标题,设备通告10秒钟并睡眠额外10秒钟并通过内核定时器唤醒。

Thanks MT_dialog

附件:
xuguizhong
离线
最后一次露面:2 years 11 months ago
加入:2017-06-30 02:46
Hi MT_dialog ,

Hi MT_dialog ,

谢谢你的演示。

我已经烧成OTP。它的工作原理。

我将我的软件与您的演示进行了比较。接下来是不同的。
Could you show me if they are correct?

again,
1.我的软件可以使用延长睡眠模式在OTP中工作。
2.使用深度睡眠模式“#define cfg_development_debug”中的系统RAM调试模式工作。
3. In OTP version, it can go into deep sleep, after BLE timer, it can touch waking up action(can`t catch port initial after waking up).
But can`t keep running.

1.文件“user_modules_config.h”中不同
#define EXCLUDE_DLG_GAP (0)
#define EXCLUDE_DLG_TIMER (0)
#define consuld_dlg_msg(1)
#define EXCLUDE_DLG_SEC (1)
#define EXCLUDE_DLG_DISS (1)
#define EXCLUDE_DLG_PROXR (1)
#define consuldure_dlg_bass(1)
#define EXCLUDE_DLG_FINDL (1)
#define consuld_dlg_findt(1)
#define EXCLUDE_DLG_SPOTAR (1)
#define consuld_dlg_custs1(1)
#define consuld_dlg_custs2(1)

2. different in setting for the system startup sleep delay
I have called arch_startup_sleep_delay_set(0) in function mnf_data_init().
(Base on waveform of your demo from scope, power start time between power on and first advert is about 130ms,
but deep sleep time is about 2.11 second. So I need to short down it to 0 delay)

3.不同的广告类型。
I have changed undirected advertise to non connectable advertise.
Say,

Demo:
cmd = app_easy_gap_undirected_advertise_get_active();
。。。
app_easy_gap_undirected_advertise_start();

我的软件:
cmd = app_easy_gap_non_connectable_advertise_get_active();
。。。。
app_easy_gap_non_connectable_advertise_start();

4.different in file "da1458x_config_advanced.h"
#define cfg_boot_from_otp.
I add one function to read data from OTP header in function mnf_data_init().

mt_dialog.
离线
最后一次露面:2个月1周前
职员
加入:2015-06-08 11:34
嗨徐开忠,

嗨徐开忠,

我可以看到的可能影响醒来的程序是你在设备启动时改变了默认睡眠时间的事实,您在董事会上使用XTAL吗?你看到2秒是SDK中的默认值是有没有能够让XTAL32的某个时间才能定居,所以设备不会睡觉。如果设备未正确解决,则低功耗时钟可能会导致系统上的不同类型。另请注意,此时间对于XTAL32是必需的,而不是使用内部RCX时。除了我没有看到任何可能造成问题的任何东西,不同模块的排除取决于您的项目,如果您不使用邮件API的配置文件或安全性,那么您可以将这些模块排除并用自定义功能替换为不同类型的模块广告这不会影响您,并且CFG_Boot_From_OTP将只读取Sysram的OTP值,而不是直接从OTP读取。

Thanks MT_dialog

xuguizhong
离线
最后一次露面:2 years 11 months ago
加入:2017-06-30 02:46
谢谢你。

谢谢你。

我正在使用内部rcx。(#define cfg_lp_clk lp_clk_rcx20)
我可以设置system startup sleep delay to 0 ?
If not ,what is min value ?

mt_dialog.
离线
最后一次露面:2个月1周前
职员
加入:2015-06-08 11:34
嗨徐开忠,

嗨徐开忠,

Since you are using the RCX then there is no need to wait for two seconds in order for the XTAL32 to settle since you dont have one. Also in your previous post you mentioned something that i cannot understand, what exactly do you mean "can't catch port after initial after waking up" ?

Thanks MT_dialog