sd_ble_gattc_write returns error 19

Hi all

I have following problem. When using  ble_nus_c_string_send to send data over NUS  sd_ble_gattc_write returns error 19 -  NRF_ERROR_RESOURCES after but the problem is data is sent and received after which i end up with double packets on the receiver side.

Receiver:

<info> app: Chunk received, len: 20, data: "XXXX AUTHENTICATE 3F"

<info> app: Waiting for more data, buffer: 20 bytes

<info> app: Chunk received, len: 20, data: "0DAD8C13F16B45BF00F8"

<info> app: Waiting for more data, buffer: 40 bytes

<info> app: Chunk received, len: 20, data: "012DCBBFCA94E848540A"

<info> app: Waiting for more data, buffer: 60 bytes

<info> app: Chunk received, len: 20, data: "012DCBBFCA94E848540A"

<info> app: Waiting for more data, buffer: 80 bytes

<info> app: Chunk received, len: 20, data: "6E54BC60642A57770C47"

<info> app: Waiting for more data, buffer: 100 bytes

<info> app: Chunk received, len: 4, data: "C1

"

<info> app: Complete command received (102 bytes): XXXX AUTHENTICATE 3F0DAD8C13F16B45BF00F8012DCBBFCA94E848540A012DCBBFCA94E848540A6E54BC60642A57770C47C1
<info> app: Chunk received, len: 4, data: "C1

"

<info> app: Complete command received (2 bytes): C1

Central:

wwr multichar completed
wwr multichar completed
TX send err: 19
wwr multichar completed
wwr multichar completed
TX send err: 19
wwr multichar completed 

I am unable to increase MTU size as nRF doesnt have memory. What are other options to handle this event?
I am using sdk 14.

  • Hi

    First off, nRF5 SDK v14.x.x is very old at this point, and only provides experimental support for the nRF52810. The best thing would be to move to the nRF Connect SDK, but you should at least move to the latest version of the nRF5 SDK (v17.1.0) that has production quality support for the nRF52810. 

    As for the error message, the NRF_ERROR_RESOURCES code here means that there are too many writes without responses queued. You need to wait for a BLE_GATTC_EVT_WRITE_CMD_TX_COMPLETE event and retry.

    Best regards,

    Simon

Related