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

RTC timeout frequency won't change

Hi,

I have successfully enable the app_timer module which toggle an output pin on every interrupt, and now I want to enable an interrupt on every 400us with %10 accuracy.

I’m using the below function to start the timer

app_timer_start(m_app_timer_id1,APP_TIMER_TICKS(1, APP_TIMER_PRESCALER),NULL);

I changed the APP_TIMER_PRESCALER value from 4 to 0 but it always generate 500Hz waveform for me, no matter what is the PRESCALER value.

I’m developing my software based on s110 template example and softdevice is enable too.

Please give me some suggestions to achieve 2500Hz frequency on the output or a new approach to achieve this goal.

Parents
  • Hi,

    The macro "APP_TIMER_TICKS" takes in two variables, which is the period in milliseconds, and the prescaler for the RTC. This macro cannot give you a lower period than 1 millisecond.

    To get a TICK of 400 us (+/- 10%), you should set the "APP_TIMER_PRESCALER" to '0' and start the timer like this:

    err_code = app_timer_start(m_app_timer_id1, 13, NULL);
    

    This will give a period of 13 / 32768 = 396.7 us.

    Cheers, Håkon

Reply
  • Hi,

    The macro "APP_TIMER_TICKS" takes in two variables, which is the period in milliseconds, and the prescaler for the RTC. This macro cannot give you a lower period than 1 millisecond.

    To get a TICK of 400 us (+/- 10%), you should set the "APP_TIMER_PRESCALER" to '0' and start the timer like this:

    err_code = app_timer_start(m_app_timer_id1, 13, NULL);
    

    This will give a period of 13 / 32768 = 396.7 us.

    Cheers, Håkon

Children
No Data
Related