Hi:
I use lld_evt_time_get to make RTC. It count incorrectly with extended sleep mode enabled if I pushed key to wakeup it. however, It could work with extended sleep mode enabled if I didn't push key. It also worked with extended sleep mode disabled.
What's wrong?
Device:
Hi ericxiong,
The application can safely call the specific function while the BLE is running and after sleep compensation has been applied. So i guess that you are calling the function to soon after wake up. Also you are not going to be able to get a fair accurancy by using the da as an RTC.
Thanks MT_dialog
after I pushed key, it would run more fast than normal.
my code to update time was placed in main_func(arch_main.c), as below:
int main_func(void)
{
...
/*
************************************************************************************
* Main loop
************************************************************************************
*/
while(1)
{
// schedule all pending events
if(GetBits16(CLK_RADIO_REG, BLE_ENABLE) == 1) { // BLE clock is enabled
....
}
myUpdateTime(); // Here is my code to call lld_evt_time_get to calculate the elapsed time.
...
}
}
is it right place to do it ? Could you tell me which code do sleep compensation?
Hi erixiong,
The BLE isn't enabled all the time in the main while loop and i can't understand where you ve placed your function. Try to call your function in the app_on_ble_powered (app_asynch_trm) or in app_on_full_power (app_asynch_proc). The compensation of the clocks is performed in function lld_sleep_compensate_func_patched in rwble.c file.
Thanks MT_dialog
Hello,I have 2 question about lld_evt_time_get.
1,You mentioned that da should not be used as accurate RTC,So what happens about lld_evt_time_get if a project wakeups synchronously from extended mode and use the function for RTC without considering the 32k crystal accuracy?
2,Dose lld_evt_time_get overflow when reaches UINT32_MAX?In current test,I dout the maximum of the function.
Hi toughworld,
When the da falls into sleep the sleeping time is measured by the low power clock. When waking up the cycles are read and translated in ble slots and correct the base time reference counter. If you dont have an accurate clock you wont be able to measure the sleeping time correctly. The base time counter is a 27-bit counter.
Thanks MT_dialog
谢谢,我明白了。