This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Timer under 5ms

Hello,

I have added a timer to my code, which I need to be of 1ms. The handler of the timer is correctly called when the timer is 5ms or above. However, if I change it to less than 5ms the handler is never called.

Here is some of the code I used (using softdevice):

[...]

static app_timer_id_t timtecil;
uint32_t counter=0;

void timtecil_handler(void * p_context)
{
	UNUSED_PARAMETER(p_context);
	counter++;
}

[...]

int main(void)
{
[...]
    
err_code=app_timer_create(&timtecil,APP_TIMER_MODE_REPEATED,timtecil_handler);
err_code=app_timer_start(timtecil,APP_TIMER_MULTIPLICADOR*0.001,NULL);

[...]

    for (;;)
    {
        app_sched_execute();
        power_manage(); 
				
    }

}

The constant APP_TIMER_MULTIPLICADOR (= 1024) is used to match the necessary number of ticks so I write only the period in seconds. I use APP_TIMER_PRESCALER = 31 (so the shortest timer possible is 0,000976563 seconds).

Any explanation?

Thank you very much.

Parents Reply Children
No Data
Related