Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_timer_ms_to_ticks wrong ASSERT

Maybe I'm wrong but this seems to be wrong ASSERT in the function: 

__STATIC_INLINE uint32_t nrf_timer_ms_to_ticks(uint32_t time_ms,
                                               nrf_timer_frequency_t frequency)
{
    // The "frequency" parameter here is actually the prescaler value, and the
    // timer runs at the following frequency: f = 16000 kHz / 2^prescaler.
    uint32_t prescaler = (uint32_t)frequency;
    ASSERT(time_ms <= (UINT32_MAX / 16000UL));
    return ((time_ms * 16000UL) >> prescaler);
}

My understanding is that max time which can be set on timer is dependent from timer frequency and timer bit width. But this assert is not dependent from prescaler(frequency) at all. What happens is: when I try to setup timer for 5min (which is 300 000) this assert occurs - changing timer frequency and/or bit width is not helping (because it can't). This is from SDK 14.2. 

Parents Reply Children
No Data
Related