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

Can not notify

Hi all!

My project is depend on the "ble_app_template",which uses the "scheld structure", I am able to read the data from app but not able to send my data with notification. I have set all the points about notification the same as the "ble_app_hrs",which is able to use notification.

When sending the data, the first 5 times the sd_ble_gatt_hvx return 0x0000, but atfer that all return 0x3003,meaning "BLE_ERROR_NO_TX_BUFFERS".What does that mean? my data is just 7bytes and I sent it every 1 seconds.

By the way,I am using SD6.0 and sdk5_2. Can some give me a help?Thank you very much!

Parents
  • Hi,

    Please refer to the documentation for sd_ble_gatts_hvx() and sd_ble_tx_buffer_count_get() for information on this.

    The application has a number of application buffers available to be queued for sending, and you must keep track of these. This is well-explained in the documentation for buffer_count_get(), but in short pseudo-code you would do something like this:

    // Get the maximum number of buffers (this is done in the CONNECTED event, only once per connection)
    uint32_t buffers_free;
    sd_ble_tx_buffer_count_get(&buffers_free);
    
    // When calling a function that consumes a buffer
    if (buffers_free > 0) { // Else, queue it internally in your app - or discard
        sd_ble_gatts_hvx(...);
        buffers_free--;
    }
    on_ble_evt(evt) {
       switch (evt->header.evt_id) {
           case BLE_EVT_TX_COMPLETE:
               buffers_free += evt.count;
               break;
          case other events:
             (...)
    

    If the connection interval is longer than the sending rate, the peer is NACKing the packets (its buffers are full), or i there is too much noise to do the full throughput you will eventually run out of application buffers. All the successfully queued packets will eventually be sent, in the same order as you queued them.

  • You are right, I could have been more clear here. I wanted to highlight that buffer_count_get() does not return the number of free buffers, but the maximum number of available buffers. I will edit my answer to mention reconnections.

Reply Children
No Data
Related