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

Avoid SDK modules who need app timers

Hello,

I'm developing an application that will run on a board without externel oscillator for RTC1 and it means no app timers support. I started from ANCS example and I see that it uses following modules that needs app timers :

  • BSP for buttons and leds;
  • BLE conn params;
  • scheduler;

What's the suggested why to have above features but without app timers ? Is the scheduler needed ?

Thanks, Paolo

Parents
  • Normally with softdevice, you select the LFCLK when you call SOFTDEVICE_HANDLER_INIT

    In your case you call for example

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, NULL);
    

    Then softdevice will start the LFCLK for your application. If your application does not use softdevice then you can do this in your app like below

    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
        
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL);
    

    And the APP_TIMER will use internal oscillator, you just need to select and start the LFCLK once

Reply
  • Normally with softdevice, you select the LFCLK when you call SOFTDEVICE_HANDLER_INIT

    In your case you call for example

    SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_RC_250_PPM_4000MS_CALIBRATION, NULL);
    

    Then softdevice will start the LFCLK for your application. If your application does not use softdevice then you can do this in your app like below

    NRF_CLOCK->LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_RC << CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK->EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK->TASKS_LFCLKSTART    = 1;
    
    while (NRF_CLOCK->EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
        
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, NULL);
    

    And the APP_TIMER will use internal oscillator, you just need to select and start the LFCLK once

Children
Related