nrfx_rtc timer doesn't start

I am trying to port a timer over to the nrfx_rtc driver and I can't seem to get it to start counting.  I'm sure I'm missing something small, but I'm not seeing it.  SDK 17, Windows 10, nRF52840, NRFX_RTC is enabled, as is RTC0 in sdk_config.  I initialize the driver up top with 

const  nrfx_rtc_t m_sample_timer = NRFX_RTC_INSTANCE(0);
 Here is my init code:

    //Initialize RTC instance
    nrfx_rtc_config_t rtc_config = NRFX_RTC_DEFAULT_CONFIG;
    rtc_config.prescaler = 32;
    err_code = nrfx_rtc_init(&m_sample_timer, &rtc_config, sample_timer_handler);
    APP_ERROR_CHECK(err_code);

    err_code = nrfx_rtc_cc_set(&m_sample_timer, 0, 2, true);
    APP_ERROR_CHECK(err_code);

    //Power on RTC instance
    nrfx_rtc_enable(&m_sample_timer);

lfclk function:

static void lfclk_config(void)
{
    ret_code_t err_code = nrfx_clock_init(NULL);
    APP_ERROR_CHECK(err_code);
    nrfx_clock_lfclk_start();
}

Everything builds fine, and no errors at runtime, but I never hit my handler.  After initialization, my RTC0 registers never change from:

And I find it weird that INTENCLR and EVTENCLR are set, but I'm not seeing where that happens?

Here is also my handler for completeness:

static void sample_timer_handler(nrfx_rtc_int_type_t event_type)
{
    ret_code_t err_code;
    if(!m_saadc_initialized)
    {
        saadc_init();
    }
    m_saadc_initialized = true; //Set SAADC as initialized
    saadc_sample();
}

Everything works fine using nrfx_timer.

Parents Reply Children
Related