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

nrf51822 rtc with softdevice

Hello,

Is there a demo project that contains RTC function with softdevice. I called the lfclk_config() and rtc_config() function before softdevice initial in main(), but it could not pass through SOFTDEVICE_HANDLER_INIT(&clock_lf_cfg, NULL). How can I sovle this issue, am I missing some settting?

void lfclk_config(void)
{
    ret_code_t err_code = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_clock_lfclk_request(NULL);
}


void rtc_config(void)
{
    uint32_t err_code;
    //Initialize RTC instance
    nrf_drv_rtc_config_t config = NRF_DRV_RTC_DEFAULT_CONFIG;
    config.prescaler = 4095;
    err_code = nrf_drv_rtc_init(&rtc, &config, rtc_handler);
    APP_ERROR_CHECK(err_code);
    //Enable tick event & interrupt
    nrf_drv_rtc_tick_enable(&rtc,true);
    //Set compare channel to trigger interrupt after COMPARE_COUNTERTIME seconds
    err_code = nrf_drv_rtc_cc_set(&rtc,0,COMPARE_COUNTERTIME * 8,true);
    APP_ERROR_CHECK(err_code);
    //Power on RTC instance
    nrf_drv_rtc_enable(&rtc);
}
Related