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

How to send more than 20 bytes using sd_ble_gatts_hvx

Hello,

I am looking for a way to send more than 20 bytes by using 'sd_ble_gatts_hvx' function. I want to get the maximum debit that is in theory 6x20 bytes Do I just have to send the set the p_len parameter to 6x20, because i didn't succeed through this way! I am using the S110 firmware and the nRF51-Dongle Thanks for you help

Parents
  • It is well described here.

    Edit 16.10.2015

    The point is that you can notify maximum 20 bytes with each call to sd_ble_gatts_hvx().

    So you call this in a loop until it returns BLE_ERROR_NO_TX_BUFFERS, then you break out of the loop. Then you will get the BLE_EVT_TX_COMPLETE event when one or more packets have been sent. So then you loop sd_ble_gatts_hvx() again until you get BLE_ERROR_NO_TX_BUFFERS, and so on.

    If you do this with the S110 you can get 6 packets in each connection interval because the TX buffer size is 6 (if the central device supports it).

  • Thanks, How can I upload my projet ? I use the s110_nrf51822_7.1.0_softdevice.hex with master control panel

    In my while loop the first sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params) call returns NRF_SUCCESS (yeah!!) after the second sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params) call returns me BLE_ERROR_NO_TX_BUFFERS. (my understanding is I succed in send 20 bytes). After getting this BLE_ERROR_NO_TX_BUFFERS, I update all the hvx_params and resend an sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params) which returns sometimes a beautifull NRF_SUCCESS and sometimes still a BLE_ERROR_NO_TX_BUFFERS??? why do you have an idea? Why sometimes I update correctly the TX BUFFER and sometimes no?

Reply
  • Thanks, How can I upload my projet ? I use the s110_nrf51822_7.1.0_softdevice.hex with master control panel

    In my while loop the first sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params) call returns NRF_SUCCESS (yeah!!) after the second sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params) call returns me BLE_ERROR_NO_TX_BUFFERS. (my understanding is I succed in send 20 bytes). After getting this BLE_ERROR_NO_TX_BUFFERS, I update all the hvx_params and resend an sd_ble_gatts_hvx(p_hrs->conn_handle, &hvx_params) which returns sometimes a beautifull NRF_SUCCESS and sometimes still a BLE_ERROR_NO_TX_BUFFERS??? why do you have an idea? Why sometimes I update correctly the TX BUFFER and sometimes no?

Children
No Data
Related