[20736]Fine timer fires during sleep ?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

20736, Wiced Smart 2.1.1.

Slight modification based on hello sensor app.

Below is the modifications:

1, fine_timer_interval = 500ms

2, In xx_create()

1) call bleprofile_KillTimer() instead of bleprofile_regTimerCb() and bleprofile_StartTimer();

2) comment out bleprofile_Discoverable().

In such setting, the device should be in sleep mode.

However, i still observed current spikes with 500ms interval(see attached) which increased the power consumption.

I also tried to call bleapptimer_stopFineTimer() after bleprofile_KillTimer(). But the fine timer still works.

Question: How to shut down the fine timer thoroughly?


many thanks

0 Likes
1 Solution
legic_1490776
Level 5
Level 5
25 likes received 10 likes received First like received

Responding in this thread -- I have seen the same behavior.

In particular, bleapptimer_startFineTimer() starts the timer, but bleapptimer_stopFineTimer() does not seem to work.

The only way I was able to keep the fine timer off was to never call bleprofile_regTimerCb() or StartTimer() or bleapptimer_startFineTimer().

At one point I set the fine timer to 1000 and called regTimerCb() in an effort to get just the coarse timer, but I am not sure whether the fine timeout was still happening, at not quite the same time.  The plot here shows what I observed that made me wonder this:

overlapped-badtimer.png

In this plot, the blue is my application running using an external RTC timer interrupt to drive its 'coarse' timer function.  The green is using bleprofile_regTimerCb() and bleprobile_StartTimers() with fine timeout set to 1000 and NULL for the  fine callback.  It looks like the processor is staying awake for a long time, perhaps waiting for the fine timer to fire which is not quite synchronized with the coarse timer?  That was my best guess -- not sure what other explanation there might be.  The rest of the code is the same, I am just invoking the handler as the coarse timer callback rather than as an interrupt handler.  (note that the time axis is in 1/3 milliseconds, y axis is microamps.)

Update: I tried not using regTimerCb() and StartTimers() and instead using bleapptimer_startAppTimer() and this seems to avoid the extra long period of being awake.  So it appears that as long as you avoid regTimerCb and StartTimers the fine timer will stay off (and probably my problem in the green trace was related to the fine timer).

Since fine timers don't seem to work, I am using the bluetooth clock timer (Wiced-Smart/tier2/brcm/libraries/inc/bt_clock_based_timer.h) instead for fine timers, which can be turned on and off.

View solution in original post

3 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Does this thread help? Turning off the timers in BCM20736S

0 Likes
Anonymous
Not applicable

It seems not until now

0 Likes
legic_1490776
Level 5
Level 5
25 likes received 10 likes received First like received

Responding in this thread -- I have seen the same behavior.

In particular, bleapptimer_startFineTimer() starts the timer, but bleapptimer_stopFineTimer() does not seem to work.

The only way I was able to keep the fine timer off was to never call bleprofile_regTimerCb() or StartTimer() or bleapptimer_startFineTimer().

At one point I set the fine timer to 1000 and called regTimerCb() in an effort to get just the coarse timer, but I am not sure whether the fine timeout was still happening, at not quite the same time.  The plot here shows what I observed that made me wonder this:

overlapped-badtimer.png

In this plot, the blue is my application running using an external RTC timer interrupt to drive its 'coarse' timer function.  The green is using bleprofile_regTimerCb() and bleprobile_StartTimers() with fine timeout set to 1000 and NULL for the  fine callback.  It looks like the processor is staying awake for a long time, perhaps waiting for the fine timer to fire which is not quite synchronized with the coarse timer?  That was my best guess -- not sure what other explanation there might be.  The rest of the code is the same, I am just invoking the handler as the coarse timer callback rather than as an interrupt handler.  (note that the time axis is in 1/3 milliseconds, y axis is microamps.)

Update: I tried not using regTimerCb() and StartTimers() and instead using bleapptimer_startAppTimer() and this seems to avoid the extra long period of being awake.  So it appears that as long as you avoid regTimerCb and StartTimers the fine timer will stay off (and probably my problem in the green trace was related to the fine timer).

Since fine timers don't seem to work, I am using the bluetooth clock timer (Wiced-Smart/tier2/brcm/libraries/inc/bt_clock_based_timer.h) instead for fine timers, which can be turned on and off.