你好,
1)在阅读了UM-B-006之后,我没有搞清楚同步唤醒和异步唤醒事件,能否举个例子描述下这两个唤醒事件的区别?
while(1)
{
------------------------------------------------------- Part 1: Scheduling (synchronous)
IF BLE is ON {
DO scheduling
DO synchronization of asynchronous events’ requests (Hook #1)
}
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Part 2: Processing of asynchronous events
DO asynchronous events processing (Hook #2)
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- Part 3: Sleep entry / exit
#if SLEEP_ENABLED
GLOBAL_INT_STOP();
DO asynchronous events sleep processing (Hook #3)
// if app has turned sleep off, rwip_sleep() will act accordingly
SET sleep_mode based on rwip_sleep() result
...............................
}
2)承接问1)参考该文档的伪代码,请问一般开发自己添加的代码应该放在哪个HOOK处理好?
非常感谢,期待你的答复。
有路过的朋友解答下吗,谢谢了
你好,
仔细阅读文档的话其实有很清楚的说明:
“In a BLE application, DA14580 could be set to either of the above mentioned sleep modes. For anadvertising event, connection event or other wireless communication event, DA14580 needs to bewoken up and go to active mode in order to send/receive packets over a BLE wireless link. Sincethese events are time based events, the BLE timer is used to wake up the system, including the BLEcore, the radio, the ARM processor and the rest of the blocks. In this case, the following conventionis used:“the system is woken up synchronously with the BLE core”.
When in Extended / Deep sleep mode, DA14580 can also be woken up by an external event andafter waking up the ARM processor can perform some functions. However, at that moment it may notyet be the time for a BLE communication event, e.g. a connection event and thus the BLE and theradio can remain in power off state. In this case, the following convention is used:“the system iswoken up asynchronously with the BLE core”.”
同步唤醒和异步唤醒的主要区别在于唤醒的来源以及BLE Core是否唤醒。同步唤醒一般由内部BLE Timer发起,除ARM处理器之外BLE Core和广播装置也唤醒工作。同步唤醒主要用于计划中的BLE相关任务,包括定期唤醒广播,扫描,连接,使用BLE传输信息等等工作时需要BLE Core以及BLE时钟进行同步的事件。而异步唤醒一般由外部中断触发,仅唤醒ARM核心及少量相关模块,用于处理一些不需要用到BLE Core的基础任务,例如一些基础的数据处理工作。当然,同步唤醒也可以由外部中断的方式来实现。
至于2)代码添加到哪个Hook取决于你的需要和具体任务。这段伪代码的实现在arch_main.c里面,用户在添加代码时一般不直接添加在这个文件,而是另外写在单独的用户文件里