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

throughput manage (BLE_ERROR_NO_TX_PACKETS)

Hello,

First of all I know that many questions were posted here about this topic but I am posting mine because I couldn't figure out how to solve my issue and I am looking for new ideas.

I am working on a project of throughput data from sensors to my central via nRF51822 through a notifying service (SDK12.2, S130).

My central is an iOS app, and my throughput data are given from STM32 via UART but am sure I get them correctly. Also am using a simple buffer not fifo.

            MIN_CONN_INTERVAL               MSEC_TO_UNITS(20, UNIT_1_25_MS)  
            MAX_CONN_INTERVAL               MSEC_TO_UNITS(40, UNIT_1_25_MS) 
            SLAVE_LATENCY                   3   

first of all I was adding packets to the TX buffer, faster than they can be sent out, and I got "BLE_ERROR_NO_TX_PACKETS " error. so I tried to make sure that my TX task is complete before initiating next one with this implementation:

  do{  
          err_code = ble_data_send(&m_data_send, data_packet);
           nrf_delay_ms(2);
    }while(err_code== BLE_ERROR_NO_TX_PACKETS);

But I still have the same problem.

What am I missing?

Is there any problem with my implementation?

Is there any example of maximum throughput manage?

Can this be a cause of my central ?

thank you in advance devzone community. PS: if you want I can give more details.

  • What kind of throughput are you getting? Why are you not sure you are getting them correctly?

    The central device dictates the connection interval, so the first thing I would check is what the actual connection interval is, see this for how to do that.

    Other than that, you algorithm for sending as much data as possible seems correct, but why do you have the nrf_delay_ms(2); in the while loop?

    The maximum throughput of the S130 is 128 kbps. This thread may also be helpful to you.

  • Hello, 1/ I am using a throughput over a Notification service(sd_ble_gatts_hvx), data from sensors HEX format.

    2/ I am sending static sensors data over my service but in my central I am not getting the same data, I have loss of data.

    3/ I checked and my connection interval is 20: the minimum value since am using iOS APP.

    4/ About the nrf_delay_ms(2); I did that to make sure that I gave to the stack some time to get the link-level ACK and eventually to free a buffer for the sending notification.

    5/ I dont think I am crossing maximum throughput of the S130, I calculated the max and I am above.

    1. I get that you are using sd_ble_gatts_hvx(). I meant what is the numerical value of the throughput you are getting.

    2. If you have loss of data this is probably an error in implementation. Could you edit your question and include some more code? Or even better, your complete project so I can test it here.

    3. Ok.

    4. Not really a good way to do it. If you get BLE_ERROR_NO_TX_PACKETS you should wait for the BLE_EVT_TX_COMPLETE event before calling sd_ble_gatts_hvx() again.

    5. Ok. How did you calculate? What number did you get?

  • 1/ I still dont understand your question: the numerical value of the throughput you are getting?

    2/ I am sorry but I cant add the complete project so I will show more about the implementation

    3/ ok

    4/ Now the throughput is going well, what I did is that I created a new instance of FIFO to get and send data through my service so I guess I was asking my FIFO for too much work. About the way to handle this, my implementation would be something like:

    	err_code = ble_data_send(&m_data_send, data_packet);
    	if (err_code == BLE_ERROR_NO_TX_PACKETS) 
           {
    			while(my_flag != true)
    			     {
    					//do nothing
    				 }
            
            err_code = ble_data_send(&m_data_send, data_packet);
    		my_flag = false;
           }
    

    and in the ble_evt_handle:

    		case BLE_EVT_TX_COMPLETE:
    			my_flag = true ;												
    			break;
    	   
    

    PS: ble_data_send() contains the sd_ble_gatts_hvx() macro. is this a good way to use the BLE_EVT_TX_COMPLETE event before calling sd_ble_gatts_hvx() again?

    5/ 6 * 20 B * 1/0.020 s = 3 kB/s = 48 kbps :this is the theoretical number for me I just need 3 per conn-interval, so : 3 * 20 B * 1/0.020 s = 3 kB/s = 24 kbps

Related