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

clock issue in FreeRTOS integration with Mesh code

Hi,

I'm using nRF52840 (rev 1.0.0) and Mesh 2.0.1 and SD 15.0.0. 

I added FreeRTOS following the example "hrs FreeRTOS".

In FreeRTOS, the source clock (configTICK_SOURCE) is configured as FREERTOS_USE_SYSTICK.

When I call nrf_drv_clock_init() and then sd_softdevice_enable(...), I get error 0x1001 "NRF_ERROR_SDM_INCORRECT_INTERRUPT_CONFIGURATION".

Without the *** init function, when FreeRTOS tries to setup the RTC in

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);
}

The call request for the clock fail cause the module ( clock) is not initialized ! " ASSERT(m_clock_cb.module_initialized);"

how can I initialize the clock and not get an error from the softdevice init function ?

Parents
  • Hi, 

     

    I suspect you got that error because the call nrfx_clock_enable() will enable the LFCLK interrupt and with high priority that not allowed by the softdevice. You should check NRFX_CLOCK_CONFIG_IRQ_PRIORITY in sdk_config.h, it should be at 7. 

     

    Another suggestion is to call sd_softdevice_enable() (or nrf_sdh_enable_request)  before initialize FREERTOS.  

    I actually don't have much experience with FreeRTOS, so not really sure if FreeRTOS need to be initialized before the softdevice or not.  

Reply
  • Hi, 

     

    I suspect you got that error because the call nrfx_clock_enable() will enable the LFCLK interrupt and with high priority that not allowed by the softdevice. You should check NRFX_CLOCK_CONFIG_IRQ_PRIORITY in sdk_config.h, it should be at 7. 

     

    Another suggestion is to call sd_softdevice_enable() (or nrf_sdh_enable_request)  before initialize FREERTOS.  

    I actually don't have much experience with FreeRTOS, so not really sure if FreeRTOS need to be initialized before the softdevice or not.  

Children
Related