如何用ble定时器醒来的深睡眠编程

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.xmece.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
12 posts / 0 new
Last post
徐金忠
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 02:46
如何用ble定时器醒来的深睡眠编程

基于SDK 5.0.3,使DA14580与BLE定时器醒来延伸睡眠,现在对我来说没问题。
But I have to make DA14580 into deep sleep with BLE timer waking up. Of course firmware is burned into OTP.

基于项目的延伸睡眠与BLE定时器醒来,我已经将其改为深入睡眠,然后是文档“training_04_sleep_modes_current_measurement_v1.0”。
Then burn it into OTP. I find that DA14580 can`t wake up from deep sleep after BLE timer.

Could you give me a DEMO for deep sleep with BLE timer waking up ? (not deep sleep with key button waking up )

Thank you

设备:
MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
Hi xuguizhong,

Hi xuguizhong,

Using the ble_app_sleep mode please check the below changed in order to operate under deep sleep mode and wake up via timer:

  • 在user_app_add_undirect_complete函数中,替换使用计时器设置的中断初始化。
    • app_sleep_timer_used = app_easy_timer(1000, user_app_adv_start);
  • The timer should be in a retained memory setion, like below:
    • timer_hnd app_sleep_timer_used __attribute __((部分(“Retent_mem_area0”),Zero_Init));// @retention内存
  • unefine cfg_development_debug,以便在深睡眠时为580切换Sysram。
  • Burn your application in the OTP.
  • 将OTP标题刻录到设置为“是”的应用程序标志

After the above you should be good to go.

谢谢mt_dialog.

徐金忠
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 02:46
嗨mt_dialog.

嗨mt_dialog.

感谢您的反馈意见。

My software is base on project ble_app_barebone of SDK 5.0.3, using RCX.
I find it has created a timer in "user_app_adv_start" function.
and this timer has been defined in RETENTION MEMORY.
没关系,对吗?

My problem:
在我的退出软件中,它可以深入睡眠(当前可以在400na中显示800na)。
它也可以在BLE定时器(例如,1秒)后醒来(通过示波器监视电流)。
但是,在醒来之后,它可以成功地继续运行。没有广告,再也没有睡觉了。
keep a higher current, say, 600 uA in Mutimeter.
当然,如果一切确认,我将再次燃烧到测试。
您是否可以确认我是否必须将软件移植到5.0.3的SDK 5.0.4?

void user_app_adv_start(void)
{
// Schedule the next advertising data update
app_add_data_update_timer_used = app_easy_timer(app_add_data_update_to,avd_data_update_timer_cb);
......
}
void user_app_add_undirect_complete(uint8_t状态)
{
//如果广告被取消,则更新广告数据并再次启动广告
if (status == GAP_ERR_CANCELED)
{
user_app_adv_start();
}
}

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
Hi xuguizhong,

Hi xuguizhong,

如果设备已成功进入睡眠模式一次(您在万用表中看到大约800na),然后您看到在下一次唤醒中,功耗约为600A,这意味着设备重置,所以我想580进入一个nmi_handler或硬盘处理程序。我不认为这是与您使用的SDK相关的东西,您必须检查设备最终的位置以及重置的原因(检查是否可以在深入睡眠下的开发模式下复制,您不会看到所需的自Sysram保持开启以来的功耗,但如果您可以在开发模式下复制,您可以跟踪更容易的原因导致问题)。从您粘贴的代码中,我没有看到任何错误,尽管我无法看到设备在永久睡眠中的位置,Adv_data_update_timer_cb()将取消广告和user_app_add_undirect_complete()将在它重新启动之后触发免疫广告。

谢谢mt_dialog.

徐金忠
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 02:46
嗨mt_dialog,

嗨mt_dialog,

I have tested deep sleep with development, everything is running good.
我在函数中添加一些测试端口“adv_data_update_timer_cb()”,“user_app_adv_start()”和“user_app_adv_undirect_complete()”。它在开发模式下运行正常。

将其刻录到OTP后,使用检查测试端口运行,
confirm that it is fail to copy firmware from OTP after deep sleep.
could you give me some clue ?
在软件中,
#define CFG_LP_CLK LP_CLK_RCX20
在OTP标题中,影响什么是“0x47F70包装”?

Thank you

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
Hi xuguiyhong,

Hi xuguiyhong,

Do you set the application flags to "Yes" in the OTP header in order for the primary bootloader to be aware that there is fw in the OTP ?

您所拥有的#define是定义您的设备要使用的低功耗时钟,如果您在降压配置中,则RCX20振荡器是一个有效的选项,您可以使用它,您所引用的字段(包使用)已亮起并识别当前580的包装类型。

谢谢mt_dialog.

徐金忠
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 02:46
嗨mt_dialog,

嗨mt_dialog,

当然,我将应用程序标志设置为OTP标题中的“是”。
And anything works OK except deep sleep waking up.

我已经尝试过任何方法来做。但失败了。
Could you send me a demo project with BLE timer waking up deep sleep(not button waking up)?
然后我把它烧成了OTP进行测试。

Thank you

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
Hi xuguizhong,

Hi xuguizhong,

Attached a modified version of the app_ble_sleepmode with a timer along with the header for the OTP, the device advertises for 10 seconds and sleeps for additional 10 seconds and wakes up via a kernel timer.

谢谢mt_dialog.

Attachment:
徐金忠
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 02:46
嗨mt_dialog,

嗨mt_dialog,

Thanks for your DEMO.

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

I compared my software with your DEMO. Next is different.
Could you show me if they are correct?
(
再次,
1.我的软件可以与扩展OTP睡眠ode.
2. work in system RAM debug mode with deep sleep mode "#define CFG_DEVELOPMENT_DEBUG"
3.在OTP版本中,它可以进入深睡眠,在BLE定时器之后,它可以触摸唤醒动作(醒来后可以捕获港口初始)。
但可以继续跑步。
)

1.different in file "user_modules_config.h"
#define consuldure_dlg_gap(0)
#define consuldure_dlg_timer(0)
#define EXCLUDE_DLG_MSG (1)
#define consuldure_dlg_sec(1)
#define consuldure_dlg_diss(1)
#define consuldure_dlg_proxr(1)
#define EXCLUDE_DLG_BASS (1)
#define consuld_dlg_findl(1)
#define EXCLUDE_DLG_FINDT (1)
#define consuld_dlg_spotar(1)
#define EXCLUDE_DLG_CUSTS1 (1)
#define EXCLUDE_DLG_CUSTS2 (1)

2.系统启动睡眠延迟的设置不同
我在函数mnf_data_init()中称为ARCH_STARTUP_SLEEP_DELAY_SET(0)。
(从范围的演示的波形基础上,电源开启和第一广告之间的电源开始时间约为130ms,
但深度睡眠时间约为2.11秒。所以我需要将其短到0延迟)

3. different in advertise type.
I have changed undirected advertise to non connectable advertise.
说,

演示:
cmd = app_easy_gap_undirected_advertise_get_active();
......
app_easy_gap_undircated_advertise_start();

My software:
cmd = app_easy_gap_non_connectable_advertise_get_active();
....
app_easy_gap_non_connectable_advertise_start();

4.文件中的文件“da1458x_config_advanced.h”。
#define CFG_BOOT_FROM_OTP
我添加一个函数来读取函数mnf_data_init()中的OTP标头的数据。

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
Hi xuguizhong,

Hi xuguizhong,

What i can see that might affect the waking up procedure is the fact that you 've altered the default sleep time when the device boots up, are you using an XTAL on your board ? You see the 2 seconds that are the default value in the SDK are there in order to let some time for the XTAL32 in order to settle, so the device doesn't go to sleep. If the device is not properly settled then the low power clock can cause different kind of issues on the system. Also be aware that this time is mandatory for XTAL32 and not when using the internal RCX. Other than that i dont see anything that could cause problems, the exclusion of different modules depends on your project, if you dont use profile or security of the message API then you can exclude those module and replace them with custom functionallity, regarding different type of advertising this will not affect you, and the CFG_BOOT_FROM_OTP will just read the OTP values from sysram and not directly from OTP.

谢谢mt_dialog.

徐金忠
Offline
Last seen:2 years 11 months ago
Joined:2017-06-30 02:46
Thank you.

Thank you.

I am using internal RCX. (#define CFG_LP_CLK LP_CLK_RCX20 )
我可以设置system startup sleep delay to 0 ?
如果没有,什么是最小值?

MT_dialog
Offline
Last seen:2个月2周前
Staff
Joined:2015-06-08 11:34
Hi xuguizhong,

Hi xuguizhong,

由于您使用的是RCX,那么无需等待两秒钟,以便XTAL32解决,因为您没有。在你上一篇文章中,你提到了我无法理解的东西,你究竟是什么意思“在醒来之后无法在初始追捕港”?

谢谢mt_dialog.