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

How send large notification?

Hello, In our project we want use a large characteristic with notification property.

I use a "ble_app_template" project from nRF5_SDK_14.2.0_17b948a\examples\ble_peripheral. In a project i added custom service with one characterics, it's length 200 byte. Property: Read;Write;Notification.

And I changed MTU size to 247.

So, as "master" I use Ubuntu PC with BlueZ stack. For connect uses "gatttool utility". After success connect in RTT i see:

<debug> nrf_sdh_ble: BLE event: 0x10.
<debug> ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
<debug> ble_gatt: Requesting to update data length to 251 on connection 0x0.
<info> app: Connected.
<debug> nrf_sdh_ble: BLE event: 0x24.
<debug> ble_gatt: Data length updated to 27 on connection 0x0.
<debug> ble_gatt: max_rx_octets: 27
<debug> ble_gatt: max_tx_octets: 27
<debug> ble_gatt: max_rx_time: 328
<debug> ble_gatt: max_tx_time: 328
<debug> nrf_sdh_ble: BLE event: 0x3A.
<debug> ble_gatt: ATT MTU updated to 23 bytes on connection 0x0 (response).
<debug> nrf_sdh_ble: BLE event: 0x12.

after in gatt tool i send command: mtu 247 for increase mtu size. In RTT added next:

<debug> nrf_sdh_ble: BLE event: 0x55.
<debug> ble_gatt: Peer on connection 0x0 requested an ATT MTU of 247 bytes.
<debug> ble_gatt: Updating ATT MTU to 247 bytes (desired: 247) on connection 0x0.

When I read a characterictics, I see all 200 bytes. But, If i enable notification, i receive only 20 bytes.

I don't understand, What have I forgotten to do yet?

P.S. Keil MDK, HW: PCA10040 v1.1.0, SW: S132

[00]ble_app_template.rar

Thanks, Best Regurds Max

  • I uploaded my "sandbox".

    Ok, I understood about sd_ble_gatts_value_set().

    I comment this part and change function:

     hvx_params.handle = p_cus->custom_value_handles.value_handle;
        hvx_params.type   = BLE_GATT_HVX_NOTIFICATION;
        hvx_params.offset = 0;//gatts_value.offset;
        hvx_params.p_len  = &size;//&gatts_value.len;
        hvx_params.p_data = custom_value;//gatts_value.p_value;
    err_code = sd_ble_gatts_hvx(p_cus->conn_handle, &hvx_params);
    

    after in NRFConnect I receive all 200 byte by notification. mystique ...

  • If I connect with NRFConnect in log i see:

    <debug> nrf_sdh_ble: BLE event: 0x10.
    <debug> ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
    <debug> ble_gatt: Requesting to update data length to 251 on connection 0x0.
    <info> app: Connected.
    <debug> nrf_sdh_ble: BLE event: 0x24.
    <debug> ble_gatt: Data length updated to 27 on connection 0x0.
    <debug> ble_gatt: max_rx_octets: 27
    <debug> ble_gatt: max_tx_octets: 27
    <debug> ble_gatt: max_rx_time: 328
    <debug> ble_gatt: max_tx_time: 328
    <debug> nrf_sdh_ble: BLE event: 0x3A.
    <debug> ble_gatt: ATT MTU updated to 247 bytes on connection 0x0 (response).
    <debug> nrf_sdh_ble: BLE event: 0x23.
    <debug> ble_gatt: Peer on connection 0x0 requested a data length of 251 bytes.
    <debug> ble_gatt: Updating data length to 251 bytes on connection 0x0.
    <debug> nrf_sdh_ble: BLE event: 0x24.
    <debug> ble_gatt: Data length updated to 251 on connection 0x0.
    <debug> ble_gatt: max_rx_octets: 251
    <debug> ble_gatt: max_tx_octets: 251
    <debug> ble_gatt: max_rx_time: 2120
    <debug> ble_gatt: max_tx_time: 2120
    

    and all data is notified.

    But if I connect with Ubuntu and send command "mtu 247" (for change mtu size) in RTT I see:

    <debug> nrf_sdh_ble: BLE event: 0x10.
    <debug> ble_gatt: Requesting to update ATT MTU to 247 bytes on connection 0x0.
    <debug> ble_gatt: Requesting to update data length to 251 on connection 0x0.
    <info> app: Connected.
    <debug> nrf_sdh_ble: BLE event: 0x24.
    <debug> ble_gatt: Data length updated to 27 on connection 0x0.
    <debug> ble_gatt: max_rx_octets: 27
    <debug> ble_gatt: max_tx_octets: 27
    <debug> ble_gatt: max_rx_time: 328
    <debug> ble_gatt: max_tx_time: 328
    <debug> nrf_sdh_ble: BLE event: 0x3A.
    <debug> ble_gatt: ATT MTU updated to 23 bytes on connection 0x0 (response).
    <debug> nrf_sdh_ble: BLE event: 0x55.
    <debug> ble_gatt: Peer on connection 0x0 requested an ATT MTU of 247 bytes.
    <debug> ble_gatt: Updating ATT MTU to 247 bytes (desired: 247) on connection 0x0.
    <debug> nrf_sdh_ble: BLE event: 0x12.
    

    I'm not processing the size change correctly?

  • I see. On Ubuntu it seems you are actually not updating the ATT MTU, you see it is still 23 (ATT MTU updated to 23 bytes). Maybe configurable ATT MTU isn't supported by whatever hardware you are using? Or maybe BlueZ doesn't support it? I'm not sure if there is much to do about that.

  • So, BlueZ claim that they meet the specifications of 4.2, but judging by the requests in the search engines there is some problem with the long packet (DLE). Thanks for the help! As a response, the comment was adopted, after the application of which the decision was found partially.

Related