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

How to make APP_TIMER_CONFIG_RTC_FREQUENCY's value 0??

I want to time period 153us.

This is my calculation.

153us = 6535Hz.

PRESCALER = (32768 Hz / 6535 Hz )-1 = 4

There is 

// <o> APP_TIMER_CONFIG_RTC_FREQUENCY - Configure RTC prescaler.

// <0=> 32768 Hz
// <1=> 16384 Hz
// <3=> 8192 Hz
// <7=> 4096 Hz
// <15=> 2048 Hz
// <31=> 1024 Hz

#ifndef APP_TIMER_CONFIG_RTC_FREQUENCY
#define APP_TIMER_CONFIG_RTC_FREQUENCY 1
#endif

But, there is no options which is 4.

In this case, how to modify APP_TIMER_CONFIG_RTC_FREQUENCY??

In addition to, APP_TIMER_CONFIG_RTC_FREQUENCY = PRESCALER??

Parents
  • Hello,

    Remember that the RTC is a physical oscillator, operating at 32768Hz, so you can only generate frequencies that are 32768/2^n Hz from this signal. That is why you only have the options:

    2^10 = 1024  Hz,
    2^11 = 2048  Hz,
    2^12 = 4096  Hz,
    2^13 = 8192  Hz,
    2^14 = 16384Hz,
    2^15 = 32768Hz,

    You can not use the RTC to generate 6535Hz.

    What you can do is to use e.g. the app timer, and figure out how many ticks 153µs will correspond to.

    Look at how the macro APP_TIMER_TICKS(MS) is implemented, and try to write something similar but with µs instead of ms.

    Best regards,

    Edvin

Reply
  • Hello,

    Remember that the RTC is a physical oscillator, operating at 32768Hz, so you can only generate frequencies that are 32768/2^n Hz from this signal. That is why you only have the options:

    2^10 = 1024  Hz,
    2^11 = 2048  Hz,
    2^12 = 4096  Hz,
    2^13 = 8192  Hz,
    2^14 = 16384Hz,
    2^15 = 32768Hz,

    You can not use the RTC to generate 6535Hz.

    What you can do is to use e.g. the app timer, and figure out how many ticks 153µs will correspond to.

    Look at how the macro APP_TIMER_TICKS(MS) is implemented, and try to write something similar but with µs instead of ms.

    Best regards,

    Edvin

Children
No Data
Related