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

Multiple Connection NUS(Nordic UART Service) Error (8 or 13313)

Hello
I'm now trying to implement the IOS Phones (Central) - Device (Peripheral) liver UART using Multiple Connection - Nordic Uart Service.
Devices tried to send a UART signal to the phone first, but it kept...
We could observe that 13313err_code or NRF_ERROR_INVALID_STATE Error occurred.
Looking at the log, it is confirmed that p_nus ->is_notification_enabled is false.

Can you tell me what caused this error?

Also, is the return value parameter p_nus->conn_handle in the ble_nus_string_send function specifying one of the Multiple Connection Devices?

uint32_t ble_nus_string_send(ble_nus_t * p_nus, uint8_t * p_string, uint16_t length)
{
    ble_gatts_hvx_params_t hvx_params;

    VERIFY_PARAM_NOT_NULL(p_nus);

    if ((p_nus->conn_handle == BLE_CONN_HANDLE_INVALID) || (!p_nus->is_notification_enabled))
    {
        return NRF_ERROR_INVALID_STATE;
    }

    if (length > BLE_NUS_MAX_DATA_LEN)
    {
        return NRF_ERROR_INVALID_PARAM;
    }

    memset(&hvx_params, 0, sizeof(hvx_params));

    hvx_params.handle = p_nus->tx_handles.value_handle;
    hvx_params.p_data = p_string;
    hvx_params.p_len  = &length;
    hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;

★    return sd_ble_gatts_hvx(p_nus->conn_handle, &hvx_params);
}

Thank you so much for reading my question and for your interest.

Related