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

stream live sensor data from ble_uart application

Hi, I want data read from my sensor (gives continuous data when button is being pressed). and then send it through Bluetooth equipment.(PC or iPhone and so on) But i don'k know how to send live sensor data until i keep pressed through Bluetooth.

I would like to transmit the my sensor data via the BLE continuously until keep pressed the button i am using ble_uart example.

My development environment is like below.

chip : nRf51822 example : ble_uart in nRF_Example 10.0.0 Please kindly comment guide or relevant Q&A issue. (I can't found relevant this issue in "Questions" tab, yet.)

  • I'm not sure how to help you. Have you set up the communication with the sensor? Have you figured out how ble_app_uart sends the data?

  • hi petter, yes i have setup everything. when i press button it gives data and data is available in data_array buffer in ble_uart. but if i keep button pressed (which keeps sending continuous data) then connection breaks. according to me this happens because i can send data using ble_nus_c_string_send() function this function can only be used 2 times per connection interval (minimum 7.5 ms). If I call this function too fast, the tx buffers fill up and i will be returned the error BLE_ERROR_NO_TX_BUFFERS.

    so what should i suppose to do so that i can send live data coming from my sensor without breaking the connection.

  • Hi Deepak

    To receive BLE_ERROR_NO_TX_BUFFERS error is normal when the softdevice buffer is full. What you need to do is to not call APP_ERROR_CHECK when BLE_ERROR_NO_TX_BUFFER error is received but to call hvx again with the same data until you do not receive BLE_ERROR_NO_TX_BUFFERS. Another way is to store the data in a buffer, start a timer, go to sleep and then try again on timer interrupt.

    There is a throughput test code here where data is sent as fast as possible over the BLE link. The BLE_ERROR_NO_TX_ERROR error code is not handled in this example, but rather the loop sends data over the link as fast as it can. Try to ignore the same error codes as in this example in line 140.

    See also these threads (1) (2) (3) (4) (5)

Related