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

Issues after combining DFU AND NUS services

I have successfully added buttonless DFU services and NUS services in my code. Both services are working.

But I have observed an issue in the NUS service. I am using the NUS service to send logs, as soon as the board power ups it begin to send the logs and it used to work fine before the merger with buttonless DFU. But after the merger I observed that it doesn't start sending the logs after the power up infect it never does until I send something to the board using the application. If I send any character to the board it begins to send the logs to the application.

/**@brief Function for initializing services that will be used by the application.
 */
void ble_initServices(void)
{
    uint32_t           err_code;
    ble_nus_init_t     nus_init;
    nrf_ble_qwr_init_t qwr_init = {0};
    ble_dfu_buttonless_init_t dfus_init = {0};

    // Initialize Queued Write Module.
    qwr_init.error_handler = nrf_qwrErrorHandler;
    err_code = nrf_ble_qwr_init(&m_qwr, &qwr_init);
    APP_ERROR_CHECK(err_code);

    // Initialize the async SVCI interface to bootloader before any interrupts are enabled.
    err_code = ble_dfu_buttonless_async_svci_init();
    APP_ERROR_CHECK(err_code);
    dfus_init.evt_handler = ble_dfuEvtHandler;
    err_code = ble_dfu_buttonless_init(&dfus_init);
    APP_ERROR_CHECK(err_code);

    // Initialize NUS.
    memset(&nus_init, 0, sizeof(nus_init));
    nus_init.data_handler = ble_nusDataHandler;
    err_code = ble_nus_init(&m_nus, &nus_init);
    APP_ERROR_CHECK(err_code);
}

If I disconnect with the board and again establish a connection with the board, I have to repeat that process again.  And If I initialize the NUS services before the DFU services then I do face the same issue but I don't have to repeat the process after the cycle of disconnect and connect. 

Can you help me? I want the NUS services to work fine like before and I don't want to send any character from the application to the board.

I am using a nRF52840 with "SEGGER Embedded Studio for ARM 5.10a" and "nRF5_SDK_17.0.0_9d13099" sdk.

Related