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

Fast advertising timeout seems to stop RTC2

This is my RTC init function. Whenever I start advertising in fast-advertising mode, and timeout for fast advertising expires, the RTC2 timer stops running and COUNTER resets to 0. I can't find anywhere that the advertising module uses RTC2 though. I'm using SDK17 with s132. When I set adv_fast to 0 thus disabling the timeout RTC2 keeps running.

void prox_rtc_init(void)
{
    // Configure the RTC for 1 minute wakeup (default)
    RTC2->PRESCALER = 0x147;
    RTC2->EVTENSET = RTC_EVTENSET_COMPARE0_Msk | RTC_EVTENSET_OVRFLW_Msk;
    RTC2->INTENSET = RTC_INTENSET_COMPARE0_Msk | RTC_INTENSET_OVRFLW_Msk;
    RTC2->CC[0] = 1000;
    RTC2->TASKS_START = 1;
    NVIC_SetPriority(PROX_RTC_IRQn, PROX_RTC_IRQ_Priority);
    NVIC_EnableIRQ(PROX_RTC_IRQn);  
}

Related