4 posts / 0 new
Last post
Dave.Renzo
Offline
Last seen:2 years 7 months ago
加入:2015-10-08 13:21
Does Timer 0 run during extended sleep?

Hello all,

I am developing an application for the da14580 (murata type zy module) that requires me to keep track of the number of minutes elapsed. Right now I am updating the advertising data using a kernel timer every minute so I am also incrementing a "minute count variable in the timer call-back function. This works great and has kept time very accurately, but the problem I have is that once a connection is made to a central device, the timer stops running. I have been trying to figure out a way around this and had the though of using one of the two hardware timers. Do these timers remain powered in extended sleep mode? Also how much power do they consume when running? Is there a better way to do what I'm trying? Any suggestions would be greatly appreciated. Thanks.

Device:
MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
Hi Dave,

Hi Dave,

The hardware timers are powered off during sleep mode. Since the accurancy of the kernel timers is enougn for you, you can try to implement a functionallity using those timers. The kernel timers aren't affected by the status of your application (if you are advertising or connected). Are you setting the timer again in the timer handler?

Thanks MT_dialog

Dave.Renzo
Offline
Last seen:2 years 7 months ago
加入:2015-10-08 13:21
Hi MT_dialog,

Hi MT_dialog,

I am initially setting the timer in user_app_init and then again in the call back:

static void minute_update_cb()
{
minute_total++;
app_minute_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, minute_update_cb);
}

Just to give you a little more info, I am working off of the ble_app_peripheral project from sdk 5. I am watching the code in the debugger and as soon as I connect using light blue on ios, the timer callback is not called. I searched the code to make sure app_easy_timer_cancel_all() wasn't being called anywhere down the line. I have found a work around for what I'm trying to do using lld_evt_time_get() but I would really like to figure out why this isn't working.

MT_dialog
Offline
Last seen:2 months 2 weeks ago
工作人员
加入:2015-06-08 11:34
嗨,大卫。首轮,

嗨,大卫。首轮,

Can you please the following: declare a timer handler next to timer used (e.x. test_timer)

实现和声明the following functions in user_custs1_impl.c

void user_app_on_db_init_complete(void)
{
default_app_on_db_init_complete();
test_timer = app_easy_timer(1000, test_timer_handler);
arch_set_pxact_gpio();
}

void test_timer_handler(void)
{
test_timer = app_easy_timer(1000, test_timer_handler);
arch_set_pxact_gpio();//this will notify you when the handler will be executed when running in smart snippets
}

Replace the default_db_complete function in the user_callback_config.h with the one you ve implemented.

Thanks MT_dialog