GATT client error NRF_ERROR_DATA_SIZE when performing GATT write even though length is less that ATT_MTU - 3

Hello Nordic team,

I have a central client BLE application on nrf52840 that performs GATT write on another BLE server device. From BLE specifications and from various posts on Nordic Dev Zone, I understand that the BLE client can perform a write of length (ATT_MTU -3) bytes at a time. In my application, I can see that the effective MTU size is set to 23. However, if the BLE client tries to perform a GATT write of 18 , 19 or 20 bytes, a GATT client error is reported with error code 12 (NRF_ERROR_DATA_SIZE ). GATT write is only successful when I try to write data of 17 bytes or lower. 

Can you please let me know what could be the possible cause for this issue?

Note that I am using nrf5 SDK for Thread and Zigbee v4.2.0 and using softdevice S140.

Kindly let me know if you need any other details.

Thanks,

Anusha

  • Hi Edvin,

    Thanks for your response. I am using the BLE peripheral from a 3rd party. So, I have asked them about the max length that is set in their application.

    I will update you once I have an answer.

    Thanks,

    Anusha

  • Hi Edvin,

    After talking to the 3rd party, I got to know that the maz MTU size for characteristic length was set to 241. When I changed NRF_SDH_BLE_GATT_MAX_MTU_SIZE to 241 on the BLE centra, then it started to work. I think this is because there were two GATT characteristics on BLE peripheral side. BLE central was writing to one characteristic and the other characteristic that needs to be read had a size close to 241 bytes. I think it was probably the application logic on the BLE peripheral that was causing the write to fail.

    I think this ticket can be closed now.

    Thanks for your support.

    Regards,

    Anusha

Related