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

  • copy paste from reference manual about the options you have to choose from for LFCLK

    LFCLK clock controller
    As illustrated in Figure 15 the system supports the following low frequency clock sources:
    • LFCLK crystal oscillator: 32.768 kHz crystal oscillator
    • LFCLK RC oscillator: 32.768 kHz RC oscillator
    • LFCLK synthesizer: 32.768 kHz synthesized from HFCLK
    

    If you do not have the first one on your product, you can choose the others. Read about clocks before you make major changes to your code.

Reply
  • copy paste from reference manual about the options you have to choose from for LFCLK

    LFCLK clock controller
    As illustrated in Figure 15 the system supports the following low frequency clock sources:
    • LFCLK crystal oscillator: 32.768 kHz crystal oscillator
    • LFCLK RC oscillator: 32.768 kHz RC oscillator
    • LFCLK synthesizer: 32.768 kHz synthesized from HFCLK
    

    If you do not have the first one on your product, you can choose the others. Read about clocks before you make major changes to your code.

Children
No Data
Related