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

sd_ble_gatts_hvx error with serializer

Hi there!

I have been working with serializer and have the below issue: I am using sd_ble_gatts_hvx() to transfer 20 bytes in burst until I get an error (TX buffer full or other errors). However, I am getting an error code 9: INVALID length for sd_ble_gatts_hvx(). Debugging further I found that it is an error while decoding at the Nordic SDK. I guess decoding fails because of invalid length though the length was <= 20. But the problem here is in spite of getting an error response, the stack is transmitting this packet most of the times. So as a work around I stopped re-transmitting the packet if the error code is 9. This still doesn't solve my problem as sometimes the packet is not transmitted for this case. Can you help me out in fixing this issue? If there is an issue with the NRF stack/SDK, is there a workaround?

I am using nrf SDK 12.1 The APP is hosted on another controller and I am using the serializer code to interface with nrf52832, S132 through UART.

Parents
  • Hi! Thanks for your response!

    1. Out of 7000 packets, I get error code as 9 for 20 to 30 packets. By packet I mean 20 byte length BLE data. As far as sd_ble_gatts_value_set() is concerned (I have used itfor on connect), I don't see any error. But I have not used this API for repeated transmissions. Also I do not get BLE_EVT_TX_COMPLETE every time I get error code as 9. Out of 20 to 30 times I get 9, I receive BLE_EVT_TX_COMPLETE for 3 to 5 times.

    2. I see the problem even when I don't use burst mode. I call sd_ble_gatts_hvx() only after TX_COMPLETE.

    3. When I implemented point 2, I see another problem:

    I get buffer full error (12290). This should not be the case as I transmit my next 20 byte packet when I get the BLE_EVT_TX_COMPLETE callback. Can you also check if the buffer handling in stack is fine. And how much is the buffer size that is allocated in the nRF stack?

Reply
  • Hi! Thanks for your response!

    1. Out of 7000 packets, I get error code as 9 for 20 to 30 packets. By packet I mean 20 byte length BLE data. As far as sd_ble_gatts_value_set() is concerned (I have used itfor on connect), I don't see any error. But I have not used this API for repeated transmissions. Also I do not get BLE_EVT_TX_COMPLETE every time I get error code as 9. Out of 20 to 30 times I get 9, I receive BLE_EVT_TX_COMPLETE for 3 to 5 times.

    2. I see the problem even when I don't use burst mode. I call sd_ble_gatts_hvx() only after TX_COMPLETE.

    3. When I implemented point 2, I see another problem:

    I get buffer full error (12290). This should not be the case as I transmit my next 20 byte packet when I get the BLE_EVT_TX_COMPLETE callback. Can you also check if the buffer handling in stack is fine. And how much is the buffer size that is allocated in the nRF stack?

Children
No Data
Related