Fine timer refuses to run at set period and runs at 1-sec period instead????

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

cross mob
Anonymous
Not applicable

Hi,

Has anybody seen this?

My definition:

#define FINE_TIMER_PERIOD          700          // In ms

The configuration array:

const BLE_PROFILE_CFG my_app_cfg =

{

/*.fine_timer_interval            =*/      FINE_TIMER_PERIOD,      // In ms

Code that sets it up (called in create function):

void contact_exchg_reg_timer()

{

    bleprofile_regTimerCb(contact_exchg_fine_timeout, contact_exchg_timeout);

    bleprofile_StartTimer();

}

Handlers (1s timer is not used):

// It will be called every fine timer tick

void contact_exchg_timer_fine()

{

     // I'm blink an LED here, but it blinks at 1 s intervals.  Why ??????

}

// It will be called every 1 sec

void contact_exchg_timer_1s()

{

    // Not used

}

Why is this happening?  I don't undersand.

Thanks!

Cheers,

Gil

0 Likes
6 Replies
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

The parameters in your bleprofile_regTimerCb function don't match the timeout functions. I'm surprised that this compiled at all, unless these functions exist elsewhere.

Jacob

0 Likes
Anonymous
Not applicable

Hi Jake,

Sorry, I forgot to copy and paste these:

// Timer callback function for contact_exchg_reg_timer

void contact_exchg_timeout(UINT32 arg)

{

    ble_trace1("timeout:%d\n", __timer_count++);

    if (arg == BLEPROFILE_GENERIC_APP_TIMER)

    {

        contact_exchg_timer_1s();

    }

}

// Timer callback function for contact_exchg_reg_timer

void contact_exchg_fine_timeout(UINT32 arg)

{

    contact_exchg_timer_fine();

}

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

What happens when you change the interval to 50 ms?

What are you using to measure the interval of the timer? Is it exactly 1000ms?

And what is the interval of the regular 1 sec timer?

Jacob

0 Likes
Anonymous
Not applicable

1. What are you using to measure the interval of the timer?

Scope

2. Is it exactly 1000ms?

Yes

3. And what is the interval of the regular 1 sec timer?

1 second

AND THE QUESTION THAT CHANGED IT ALL:  

4. What happens when you change the interval to 50 ms?

It works !!!

So I investigated and tried different values.  I found out that it works until 500 ms.  From 501 ms and on it does 1 second.

Do you know why?  Is that the intended upper limit for the fine timer?

Thanks.

Gil

0 Likes
JacobT_81
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

I'm unsure why you're losing functionality above 500ms. To the best of my knowledge, it should work all the way up to 1000ms. I'll look into this and see if I can emulate it.

If you're absolutely in need of a timer above 500ms, for now you may want to explore running timers off of the bt clock.

Jacob

0 Likes
Anonymous
Not applicable

I'm using a value less than 500 ms for now.

But I would like to find out why > 500 ms does not seem to work.

0 Likes