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

The error occurred on sd_ble_gatts_hvx(), error code 0x3401.

I have a question:

I found a problem when using D:\nRF52832\examples\ble_peripheral\ble_app_uart sample code and SoftDevice S132 on PCA10040. (nRF5_SDK_17.0.2_d674dde)

The problem occurs as follows:

Step 1. Add a message to the event id BLE_GAP_EVT_CONNECTED in ble_evt_handler to notify the PC program has been connected, the example is as follows:

        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);
            sprintf(DisplayBuff,"+CONNECT NUS\r\n");
            PrintString(DisplayBuff);
            break;

Step 2. Execute nRF UART 2.0 on the mobile phone, execute the Connect function, and establish a connection.

Step 3. When the PC program receives the +CONNECT NUS string, wait for 1 second and then send a 100-byte data to the mobile phone every 0.3 seconds through the UART.

Step 4. If the APP on the mobile phone can normally receive the data from the PC, select Disconnect and repeat step 2.

Step 5. An error may occur in sd_ble_gatts_hvx(), error code 0x3401.

The current way to avoid the problem is to relax the waiting in step 2 to 3.5 seconds, then it can be solved.
But is there a better way?
Can you determine the content of a variable before calling ble_nus_data_send so that this error will not occur?

I saw this error in another article, but it doesn't seem to be the correct solution.

Parents Reply Children
No Data
Related