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

Is TIMER2 now being used by Softdevice??

Recently updated to SDK11 + s130 v2.0.1 on an nRF51822 xxAC LFCLKSRC=RC

BLE Advertising no longer works. Localized it to our use of TIMER2 for an implementation of systick();

void systick_init(void)
{
    NRF_TIMER2->MODE          = 0x0000;   // set timer mode
    NRF_TIMER2->TASKS_CLEAR   = 1;        // clear the task first to be usable for later
    NRF_TIMER2->PRESCALER     = 0x0004;   // 16 MHz clock, prescaler 16 -> 1us time step
    NRF_TIMER2->BITMODE       = 0x00;     // set counter to 16 bit resolution
    NRF_TIMER2->CC[0]         = 1000;
    NRF_TIMER2->INTENSET      = (1 << 16);

    NVIC_EnableIRQ(TIMER2_IRQn);          // enable interrupt on Timer 2

    NRF_TIMER2->TASKS_START = 1;          // start timer
}

If we call systick_init(); we no longer get BLE Advertisements. We have not seen anything in the SD Specification, SD API, or release notes regarding changes to TIMER2. Has something changed? If we skip this function, advertising works as it did prior to the update.

Parents
  • 0x02, that's easy then.

    #define NRF_ERROR_SOFTDEVICE_NOT_ENABLED   (NRF_ERROR_BASE_NUM + 2)
    #define 	NRF_ERROR_BASE_NUM   (0x0)
    

    so you're calling the set tx power before you enable the softdevice. I would hazard a guess that the softdevice init takes a little longer than before and your timer handler goes off and results in your calling the power set in the wrong order. Or something like that.

Reply
  • 0x02, that's easy then.

    #define NRF_ERROR_SOFTDEVICE_NOT_ENABLED   (NRF_ERROR_BASE_NUM + 2)
    #define 	NRF_ERROR_BASE_NUM   (0x0)
    

    so you're calling the set tx power before you enable the softdevice. I would hazard a guess that the softdevice init takes a little longer than before and your timer handler goes off and results in your calling the power set in the wrong order. Or something like that.

Children
No Data
Related