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

nRF52840 not advertising after disconnect

I'm developing a product using an nRF52840 and an accelerometer. 

I have created a Service with characteristic that sends accelerometer data over ble to the phone through notification. I have a problem that I do not know how to solve with disconnecting from device, when I disconnect the advertisement does not restart. The light is not blinking and the log not showing "advertising fast".

Current behavior only happens after I request notification from the phone. Lets say if i just connect and disconnect everything is fine, but if i connect, enable notification, then disable and disconnect, device doesn't restart advertising. It says "Disconnected" but that's it. In my service on notification callback i turn on accelerometer interrupt, and then send data, or start app_timer and send the data that way. Interestingly if i comment out enable interrupt or app_timer_start, everything seems to be ok.

The app is based on Template App.

Any idea what can be stopping the app from advertising?? Much help would be appreciated.

static void on_imus_evt(ble_imus_t * imus, ble_imus_evt_t * p_evt)
{
    switch (p_evt->evt_type)
    {
        case BLE_IMUS_EVT_NOTIFICATION_ENABLED:
            NRF_LOG_INFO("IMUS EVNT: NOTIF ENABLED");
            //icm42_enable_interrupt(&sensor_icm42);
            app_timer_start(measurement_timer, APP_TIMER_TICKS(100), NULL);
            break;
    
        case BLE_IMUS_EVT_NOTIFICATION_DISABLED:
            NRF_LOG_INFO("IMUS EVNT: NOTIF DISABLED");
            //icm42_disable_interrupt(&sensor_icm42);
            app_timer_stop(measurement_timer);
            break;
    
        default:
            // No implementation needed.
            break;
    }
}
  

Parents Reply Children
No Data
Related