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

nrf_drv_clock_lfclk_request required by freeRTOS but is part of legacy drivers

SDK 15.2

port_cmsis_systick.c 

void vPortSetupTimerInterrupt( void )
{
    /* Request LF clock */
    nrf_drv_clock_lfclk_request(NULL);

    /* Configure SysTick to interrupt at the requested rate. */
    nrf_rtc_prescaler_set(portNRF_RTC_REG, portNRF_RTC_PRESCALER);
    nrf_rtc_int_enable   (portNRF_RTC_REG, RTC_INTENSET_TICK_Msk);
    nrf_rtc_task_trigger (portNRF_RTC_REG, NRF_RTC_TASK_CLEAR);
    nrf_rtc_task_trigger (portNRF_RTC_REG, NRF_RTC_TASK_START);
    nrf_rtc_event_enable(portNRF_RTC_REG, RTC_EVTEN_OVRFLW_Msk);

    NVIC_SetPriority(portNRF_RTC_IRQn, configKERNEL_INTERRUPT_PRIORITY);
    NVIC_EnableIRQ(portNRF_RTC_IRQn);
}

 nrf_drv_clock_lfclk_request is part of the legacy drivers that will eventually be removed? 

Does this mean for FreeRTOS I need to keep using the legacy clock driver?

Is this likely to change?

Parents
  • Hi Ceri,

    The nrf_drv_clock_lfclk_request is actually used as a wrapper and if you take a look inside the function you will see it uses nrfx_clock_lfclk_start to start timers. This is not likely to change in the near future.

    To enable the NRF_CLOCK module in sdk_config.h, just search for the following lines of code:

    // <e> NRF_CLOCK_ENABLED - nrf_drv_clock - CLOCK peripheral driver - legacy layer
    //==========================================================
    #ifndef NRF_CLOCK_ENABLED
    #define NRF_CLOCK_ENABLED 1
    #endif

    You will also need to enabled the NRFX_CLOCK module in the same way.

    Best Regards,

    Marjeris

  • My point is that NRF_CLOCK is a type defined in nrf52.h.....

    #if NRF_MODULE_ENABLED(NRF_CLOCK) therefore wont work?

    Shouldnt this be :

    nrf_drv_clock.c

    #if NRF_MODULE_ENABLED(NRF_CLOCK_ENABLE)

    Or have I mistaken some other working of the system?

    This is a change 15.0 -> 15.1

     -#if NRF_MODULE_ENABLED(CLOCK) - 15.0
    +#if NRF_MODULE_ENABLED(NRF_CLOCK)  - 15.1

  • Hi,

    NRF_MODULE_ENABLED is define in nordic_common.h:

    #define NRF_MODULE_ENABLED(module) \
        ((defined(module ## _ENABLED) && (module ## _ENABLED)) ? 1 : 0)
    #endif

    Regards,

    Marjeris

Reply Children
Related