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

System halt right after BLE disconnection associated nrfx_rtc_enable

Hello,

My BLE peripheral device based on BLE uart example with nrf52832 has an issue. 

My device is paired with central device and I turned off the central. My device started advertising as expected. I turned on the central and my device connected but halted right after that with ERROR 3735928559 at nrfx_rtc.c:130

in the situation, LED_1 is on (like it is pconnected) and any button doesn;t work.

00> <info> app: Disconnected. conn_handle: 0x0, reason: 0x15 <<-- This is disconnection by turning off the central
00> 
00> <info> app: Connected <<-- connected as soon as central tuning on
00> 
00> <error> app: ERROR 3735928559 [Unknown error code] at C:\Users\shuchoi\Dropbox\Dev\nRF52\nRF5_SDK_17.0.2_d674dde\modules\nrfx\drivers\src\nrfx_rtc.c:130
00> 
00> PC at: 0x0002F47F
00> 
00> <error> app: End of error report

nrfx_rtc.c c:130 is the line of NRFX_ASSERT(m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_INITIALIZED);

void nrfx_rtc_enable(nrfx_rtc_t const * const p_instance)
{
    NRFX_ASSERT(m_cb[p_instance->instance_id].state == NRFX_DRV_STATE_INITIALIZED);

    nrf_rtc_task_trigger(p_instance->p_reg, NRF_RTC_TASK_START);
    m_cb[p_instance->instance_id].state = NRFX_DRV_STATE_POWERED_ON;
    NRFX_LOG_INFO("Enabled.");
}

Please advise me where do I start debuging and what is likely to be root cause. Thanks. 

  • Found the issue and moved nrf_drv_rtc_enable function under main().

     

    static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
    {
        uint32_t err_code;
    
        switch (p_ble_evt->header.evt_id)
        {
            case BLE_GAP_EVT_CONNECTED:
                NRF_LOG_INFO("Connected");
                err_code = bsp_indication_set(BSP_INDICATE_CONNECTED);
                APP_ERROR_CHECK(err_code);
                m_conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
                err_code = nrf_ble_qwr_conn_handle_assign(&m_qwr, m_conn_handle);
                APP_ERROR_CHECK(err_code);
    
                //nrf_drv_rtc_enable(&rtc); --> create the disconnection issue

Related