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

ble_uart problem with dfu

Hardware (HW)

  • BMD 350 evaluation board, equivalent to PCA10040

Software

  • nRF5 SDK 12.0. Keil uVersion 5 IDE.

  • SoftDevice: s132_nrf52_3.0.0_softdevice.hex

  • Firmware application (FA): nRF5_SDK_12.0.0_3bcc1f7\examples\ble_peripheral\experimental_ble_app_buttonless_dfu

Modified dfu main.c:

  1. Add uart service init code to service_init after dfu service init
  2. Add nus_data_handler to handle data received from BLE

Compiling OK, firmware flashing OK and running.

From Android "nRF Toolbox", I can see both dfu and uart services and connect device with UART panel. However, when I try to send text to device, nus_data_handler is not triggered.

Parents
  • You're not dispatching the BLE events to the NUS BLE event handler, you need to add the ble_nus_on_ble_evt() event handler to the ble_evt_dispatch() function in main.c

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_state_on_ble_evt(p_ble_evt);
        pm_on_ble_evt(p_ble_evt);
        ble_conn_params_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
        on_ble_evt(p_ble_evt);
        ble_advertising_on_ble_evt(p_ble_evt);
        ble_dfu_on_ble_evt(&m_dfus, p_ble_evt);
    
        /* Add Missing NUS BLE event handler */
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    }
    
Reply
  • You're not dispatching the BLE events to the NUS BLE event handler, you need to add the ble_nus_on_ble_evt() event handler to the ble_evt_dispatch() function in main.c

    static void ble_evt_dispatch(ble_evt_t * p_ble_evt)
    {
        ble_conn_state_on_ble_evt(p_ble_evt);
        pm_on_ble_evt(p_ble_evt);
        ble_conn_params_on_ble_evt(p_ble_evt);
        bsp_btn_ble_on_ble_evt(p_ble_evt);
        on_ble_evt(p_ble_evt);
        ble_advertising_on_ble_evt(p_ble_evt);
        ble_dfu_on_ble_evt(&m_dfus, p_ble_evt);
    
        /* Add Missing NUS BLE event handler */
        ble_nus_on_ble_evt(&m_nus, p_ble_evt);
    }
    
Children
Related