lld_evt_time_get() returns 0

⚠️
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.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
8 posts / 0 new
Last post
BenjaminDu
Offline
Last seen:2 months 1 week ago
加入:2016-03-14 02:38
lld_evt_time_get() returns 0

Hi Dialog,

I found sometimes lld_evt_time_get() returns 0, how could this happen? and how to avoid it?

Thanks

Benjamin

Dec 22nd

Device:
CYibin
Offline
Last seen:7 months 5 days ago
Staff
加入:2017-12-14 02:48
Hi Benjamin,

Hi Benjamin,

Where do you call the lld_evt_time_get() function?

The application can safely call this function while:
1. BLE is active and
2. after sleep compensation has been applied. (This is needed because lld_evt_time_get() reads a counter that is not running while 580 sleeps). Notice that the sleep compensation is done by SW when the BLE core wakes up.

Br

Yibin

BenjaminDu
Offline
Last seen:2 months 1 week ago
加入:2016-03-14 02:38
Hi dialog,

Hi dialog,

I used DSPS example, and used a timer, the interval is 160(0.625ms as a unit(timer0_set(20000, 0, 0)))

the code as following:

void timer_callback(void)

{

arch_printf("Time=%d\r\n",lld_evt_time_get());

}

The out put as in the attached.

As in the attached, if the two 585(not 580 as in your mail) get connected, the output is sometimes 0, and sometimes is not 0, and if not 0, the interval is not exactly 160, if the two 585 is not connceted, the output is 160,my code is running on the host side.

Hope you can help to analyse why this can happen and how to avoid it.

Thanks

Benjamin

Jan 6th,2020.

Attachment:
BenjaminDu
Offline
Last seen:2 months 1 week ago
加入:2016-03-14 02:38
Hi Dialog,

Hi Dialog,

In short, my question is in DSPS example, when the two 585 get connected, why sometimes lld_evt_time_get() returns 0?

The function is call in a timer.

Thanks

Benjamin

Jan 7th

PM_Dialog
Offline
Last seen:1 day 1 hour ago
Staff
加入:2018-02-08 11:03
Hi BenjaminDu

Hi BenjaminDu

The lld_evt_time_get() measures the time based on the 625us base time counter and returns the value of the BLE timer. That counter doesn't have a steady clock input but changes depending whether the device is sleeping, or it is awake and measures the time passed from power up based on the XTAL16 and the XTAL32. So the time that is measured is from the XTAL16 and when asleep the time that has elapsed during sleep is measured through the XTAL32 and gets compensated and applied to the timer when the device is awake. Is your device always active or you are using any of the sleep modes?

Thanks, PM_Dialog

BenjaminDu
Offline
Last seen:2 months 1 week ago
加入:2016-03-14 02:38
Hi Dialog,

Hi Dialog,

Thanks a lot for your quick reply.

1)I only use a timer to call lld_evt_time_get(),and I don't change the sleep mode, and if the two 585 get connected,lld_evt_time_get() automatically returns 0 and none 0, canyou have a look of my mail before last?can you refer the attached output?

2)有什么功能我可以叫后悔urn the current sleep mode? then I can know the sleep mode when lld_evt_time_get() returns 0 and none 0.

Thanks

Benjamin

Jan 8th

BenjaminDu
Offline
Last seen:2 months 1 week ago
加入:2016-03-14 02:38
Hi dialog,

Hi dialog,

To test the sleep mode,Is there any function I can call to return the current sleep mode? then I can know the sleep mode when lld_evt_time_get() returns 0 and none 0.

Thanks

Benjamin

Jan 10th

PM_Dialog
Offline
Last seen:1 day 1 hour ago
Staff
加入:2018-02-08 11:03
Hi BenjaminDu,

Hi BenjaminDu,

Please change the app_default_sleep_mode in uder_config.h to ARCH_SLEEP_OFF. Please use t arch_get_sleep_mode() API in order to the current sleep mode of operation.

Thanks, PM_Dialog