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?
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?
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);
}
I checked the external crystal. it is running at 32.768K. Changed the timer to 1Sec, got 740ms on the scope.
I started to peel things off. of course, when I only have the timer left in the software, 1 sec is dead on.
But when I start to add things back, such as enabling the softdevice, adding more timers, the 1 Sec timer speeds up more and more.
I tried using TIMER2 to make a simple interrupt based timer at 125us, no problem, dead on. Just for cross checking and to see how deep is the problem.
Something is funny going on here. Anybody had the same issue?
Nordic Engineer please chime in. Thanks
You say that it changes when you enable the softdevice. Which clock source do you input towards the softdevice enable call? That will override the setting you do manually.
Hi Thanks for the reply. What do you mean by "which clock source do you input towards the softdevice"? You may be hitting at something, but I need to understand your suggestions first :-)