This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to send more than 8 packets of 20bytes to ble app using notification

Hello, I am using sdk12 and uart code. I want to send my sensor data readings to ble app. For that I have modified the ble_app_uart code and I am able to send 8 packets of 20 bytes using ble_nus_string_send function. But my challenge is I am not getting more than 8 packets in the app. I think that the queue size is set to 8. Which buffer should I allocate more storage?

I am attaching my main.c New Text Document (3).txt

I have checked the error code of ble_nus_string function. It returns me success until it sends 8 packets and than it returns error after 8th packet.

Error - queueerror.PNG

Thanks, Shailav

Parents
  • Hi,

    With S132 v.3.0.0 (SDK12) you will get a BLE_ERROR_NO_TX_PACKETS error code when the buffer is full (7 packets with high BW). You have to wait for any pending packets to be sent and retry later. You can handle this in several ways. If you don’t care about wasting CPU time and current, you can just make some sort of if(returned error == BLE_ERROR_NO_TX_PACKETS) check, and simply keep trying again until the function return NRF_SUCCESS. A better approach is to use the BLE_EVT_TX_COMPLETE event, and keep track of the buffers that you can use. There are many posts about this on Devzone, here are is a list of some you can check out:

    devzone.nordicsemi.com/.../

    devzone.nordicsemi.com/.../

    devzone.nordicsemi.com/.../

    devzone.nordicsemi.com/.../


    Note that this is changed in S132 v.4.0.2 (SDK13), here the application packet concept has been replaced with a dedicated transmission queue for Handle Value Notifications. The number of Handle Value Notifications that can be queued is now configured by ble_gatts_conn_cfg_t::hvn_tx_queue_size by the application. When the queue is full, the function call will now return NRF_ERROR_RESOURCES. BLE_ERROR_NO_TX_PACKETS / BLE_ERROR_NO_TX_BUFFERS is no longer used. A BLE_GATTS_EVT_HVN_TX_COMPLETE event will be issued as soon as the transmission of the notification is complete.

  • From the photo you uploaded, you are getting error code value of 12292. If you convert this value to hex, the value becomes 0x3004. And 0x3004 is BLE_ERROR_NO_TX_PACKETS.

    This error code is defined in a file called ble_err.h, as

    #define BLE_ERROR_NO_TX_PACKETS          (NRF_ERROR_STK_BASE_NUM+0x004) /**< Not enough application packets available on this connection. */
    

    where NRF_ERROR_STK_BASE_NUM is defined as (0x3000) in nrf_error.h

Reply
  • From the photo you uploaded, you are getting error code value of 12292. If you convert this value to hex, the value becomes 0x3004. And 0x3004 is BLE_ERROR_NO_TX_PACKETS.

    This error code is defined in a file called ble_err.h, as

    #define BLE_ERROR_NO_TX_PACKETS          (NRF_ERROR_STK_BASE_NUM+0x004) /**< Not enough application packets available on this connection. */
    

    where NRF_ERROR_STK_BASE_NUM is defined as (0x3000) in nrf_error.h

Children
No Data
Related