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

nRF51 RTX timer run too fast

nRF51 RTX 4.74.0-3 SoftDevice S210 V4.0.1-3

Created a timer for 5 seconds interval. It turned to be 4.4 seconds. with or without softdevice enabled.

Anybody else has the same issue?

Parents
  • What do you use as clock source for the RTC? I assume you're using a 32 kHz perhaps? Depending on which clock source you use for the RTC, the timer will have the same accuracy. So if you for example use the non-calibrated on board 32 kHz RCOSC you will have quite "bad" accuracy on the clock source used for the timer.

  • External crystal, which is the default int RTX_Conf_CM.c

    int os_tick_init (void)

    {

    NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
    NRF_RTC1->PRESCALER   = OS_TRV;
    NRF_RTC1->INTENSET    = RTC_INTENSET_TICK_Msk;
    NRF_RTC1->TASKS_START = 1;
    
    return (RTC1_IRQn);
    

    }

Reply
  • External crystal, which is the default int RTX_Conf_CM.c

    int os_tick_init (void)

    {

    NRF_CLOCK->LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
    NRF_RTC1->PRESCALER   = OS_TRV;
    NRF_RTC1->INTENSET    = RTC_INTENSET_TICK_Msk;
    NRF_RTC1->TASKS_START = 1;
    
    return (RTC1_IRQn);
    

    }

Children
No Data
Related