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

got error while sending longer data via BLE

Hello, 

On nRF5340, sdk v1.6.1, I use this function to send data to center via BLE:

ble_data_send( ble_connection, data, 182 );

and here is the definition of the function:

bool ble_data_send( struct bt_conn * conn, const uint8_t * data, uint16_t len )
{
    const struct bt_gatt_attr *attr = &ble_collect_service.attrs[4];

    struct bt_gatt_notify_params params =
    {
        .uuid = BT_UUID_CLS_DATA,
        .attr = attr,
        .data = data,
        .len = len,
        .func = NULL
    };

    // Check whether notifications are enabled or not
    if( bt_gatt_is_subscribed( conn, attr, BT_GATT_CCC_NOTIFY ) )
    {
        if( bt_gatt_notify_cb( conn, &params ) )
        {
            return false; // Send failed
        }
        else
        {
            return true;
        }
    }
    else
    {
        return false; 
    }
}

but while running I got this error:

00> [00:00:26.132,934] <wrn> bt_att: No ATT channel for MTU 185
00> [00:00:26.132,934] <wrn> bt_gatt: No buffer available to send notification

It seems the length of the data to be sent is too long(182 bytes). If I set the data length to 4, then there is no error.

How to solve this problem? how to send longer(182 bytes) data?

Thanks.

Related