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

OTA NRF52832

Hello, I want to ask a question. We have a project that needs OTA function. There are two Bluetooth devices A and B.

1. Both A and B are central_and_peripheral

2. A's peripheral role and mobile phone connection

3. The centeral role of A is connected with the peripheral role of B

4. First, A and B are connected, and then A is connected with the mobile phone, and then the mobile phone OTA to A, but A cannot enter the bootloader

Through Debug and query, it is caused by the different handls caused by the two connection events, in the ble_dfu.c file,

static void on_rw_authorize_req(ble_evt_t const * p_ble_evt)
{
    if (p_ble_evt->evt.gatts_evt.conn_handle != m_dfu.conn_handle)
    {
        return;
    }
}

Is this situation normal, or is there any optimization?

Parents
  • Hello,

    The DFU service implementation assumes that the device is operating as a GAP peripheral only, so there are no checks on what the connection type is when m_dfu.conn_handle gets assigned in ble_dfu.c:on_connect()

    You may try something like this:

    ble_dfu.c

    /**@brief Connect event handler.
     *
     * @param[in]   p_ble_evt   Event received from the BLE stack.
     */
    static void on_connect(ble_evt_t const * p_ble_evt)
    {
        if (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH)
        {
            m_dfu.conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
        }
    }
    

Reply
  • Hello,

    The DFU service implementation assumes that the device is operating as a GAP peripheral only, so there are no checks on what the connection type is when m_dfu.conn_handle gets assigned in ble_dfu.c:on_connect()

    You may try something like this:

    ble_dfu.c

    /**@brief Connect event handler.
     *
     * @param[in]   p_ble_evt   Event received from the BLE stack.
     */
    static void on_connect(ble_evt_t const * p_ble_evt)
    {
        if (p_ble_evt->evt.gap_evt.params.connected.role == BLE_GAP_ROLE_PERIPH)
        {
            m_dfu.conn_handle = p_ble_evt->evt.gap_evt.conn_handle;
        }
    }
    

Children
Related