Basic Design Kit for development
DA14580(Murata模块在定制板上)
SDK 5.0.4
Hello Dialog,
I had previously worked with SDK 5.0.3 and invoked extended sleep and wakeup functions without problems. Now I have a new design and I am using SDK 5.0.4. For some reason the wakeup doesn't seem to be functioning quite the same. I'm not getting a wakeup when setting the wakeup pin active. I tried following the ble_app_sleepmode example, which seems almost the same as what I did previously in SDK 5.0.3. They added a app_easy_wakeup_set(app_wakeup_cb); line which I hadn't used before. I included this and the callback, which looks like it just restarts advertising. I'm wondering if I should only have the one callback and restart advertising there, but I tried that and it didn't work either.
Are there any configuration parameters that I should check? Before I had to use #define WKUP_ENABLE but the example doesn't appear to require this.
I have app_default_sleep_mode = ARCH_EXT_SLEEP_ON and #define CFG_MEM_MAP_EXT_SLEEP set.
To invoke sleep in the advertising complete routine I'm doing:
app_easy_wakeup_set(app_l0_wakeup_cb);
wkupct_register_callback(app_l0_wakeup_cb);
wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_PORT_0, GPIO_PIN_7), // select DIALOG_WAKEUP pin P0_7
WKUPCT_PIN_POLARITY(GPIO_PORT_0, GPIO_PIN_7, WKUPCT_PIN_POLARITY_HIGH), // polarity high
1, // 1 event
0); // debouncing time = 0
ARCH_BLE_EXT_WAKEUP_ON();//转到睡眠悬挂唤醒引脚输入
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
I'm not seeing advertising restart when I toggle the P0_7 pin, so I'm not sure I ever get to the wakeup_register_callback, but there I have:
静态void app_l0_wakeup_cb(void)
{
if(getBits16(sys_stat_reg,per_is_down))
{
periph_init();
}
if(arch_ble_ext_wakeup_get()))
{
arch_set_sleep_mode(app_default_sleep_mode);
ARCH_BLE_FORCE_WAKEUP();
arch_ble_ext_wakeup_off();
app_easy_wakeup();
// Start a 30 second timer
// Will go back to sleep if no connect within 30 seconds
sleep_timer = app_easy_timer(3000, sleep_timer_cb_handler); // Set to 30 seconds
// Restart advertising
user_app_adv_start();
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
如果您看到此内容,请告诉我。
Thanks, Max
Hi Max44,
I dont see anything that is wrong with the code that you have implemented, the code looks identical with the ble_app_sleepmode, so it should work, what i can see that most probably can go wrong is the condition that is checking with the arch_ble_ext_wakeup_get(), in case that function returns 0 then nothing within that condition will be executed, so check if the interrupt is triggered and the app_L0_wakeup_cb() function is executed. Besides that you should also check that the line connected on P07 is actually toggled by the external device or sesnor or whatever is connected on the P07 pin.
Thanks MT_dialog
MT,
谢谢。对于输入。
今天早上我确实验证了P0_7引脚是否正在设置。它是由外部MCU驱动,我设置了一个测试切换。我可以从DA14580代码中读取状态,因此连接看起来很好。
我也看过da寄存器,我看到了在wkup_select_p0_reg和wkup_pol_p0_reg中为高极性设置的p0_7。我还看到WKUP_CTRL_REG中启用了唤醒中断。
I had previously tried just eliminating the arch_ble_ext_wakeup_get() condition, but will revisit that and see if I can somehow verify the interrupt is being triggered. I find it difficult to debug when sleep modes are being invoked.
Regards, Max
MT,
一些额外的信息。这种设计与我们之前的设计相比没有32kHz水晶。我假设我们可以使用内部低速振荡器和我将GFG_LP_CLK配置为LP_CLK_RCX20。看着设置有点“额外的低腐烂”。我不确定这意味着什么。此外,我已经阅读了另一个关于使用RCX20的另一个帖子,即可能需要一些PMU设置?我不确定在那里做什么,如果这会影响唤醒中断。我们正在运行几个AA电池,用于测试3.3V,但最终将移动到可能具有稍低电压的硬币电池。
Thanks, Max
Hi Max44,
由于您以Buck模式运行,因此无法使用外部XTAL32,并且您可以通过使用LP_CLK_RCX20定义CFG_LP_CLK来配置,因此我不会以上面提到的“额外的低频”来实现您的意思您应该做的唯一配置以便使用内部RCX振荡器,并且我不认为这将影响580的唤醒定时器模块。
Thanks MT_dialog
MT,
所以可以自动发生降压模式?无需配置设置?
The "Extra low frequency" I mentioned was a bit in the register CLK_RCX20K_REG in the datasheet. I looked at that register to verify that the RCX20 was enabled. If you say the RCX20 configured correctly by LP_CLK_RCX20 I won't worry about it.
So ..... thanks for the additional info. I'm back to trying to determine if the wakeup interrupt is triggered.
Regards, Max
Hi Max44,
是的,该设备将根据使用每次系统为启动的硬连线状态机进行激活的外部连接,自动检测应用程序的操作模式,没有额外的组合,应该在SDK中完成。相同的代表通过通过#define将来自RCX和XTAL32的LP时钟更改为OBS,该设备将自动配置并通过SDK启用正确的振荡器。
Thanks MT_dialog
嗨max,
我的开发的基本来源也是BLE_APP_SLEEPMODE参考设计。
Maybe you have the same problem, I also have had.
在函数void user_app_adv_start它是写的:arch_set_deep_sleep()!
如果您正在使用扩展的睡眠模式,这是错误的。
Then you have to change to arch_set_extended_sleep()
花费我2天,因为在SleepMode中,调试器功能有限。
希望你有个美好的一天
cheers Siegmar
谢谢Siegmar。我会保持深度睡眠模式。
Max
MT,
I finally got this all working. As you said, the RCX20 oscillator works fine and I'm getting the interrupt and callback from P0_7 being toggled by the external MCU. What I found was an error in the setup for app_easy_wakeup_set. I had copied the callback from the example and didn't change it to my routine, resulting in a malfunction. I corrected this in my original post so it wouldn't be taken as a bad example to others looking at this.
所以我们对这个问题很好,你可以关闭这个话题。再次感谢您通常的良好支持。
Max
Hi Max44,
谢谢你让我们知道,总是一种乐趣。
最好的问候mt_dialog.