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

I want to reduce the data rate of nrf52840

I have developed  data loggers based on nrf52840,it uses nus service,max payload is of 240 bytes,the device stores 30kb data in a spi memory.we have a custom built android app which downloads the data from the device.while transfering the data to the mobile app from the device i wait for BLE_GATTS_EVT_HVN_TX_COMPLETE to transfer  next chunk of data which is usually 240 or less bytes.

logger parameters

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(7.5, UNIT_1_25_MS) 
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(75, UNIT_1_25_MS)
#define SLAVE_LATENCY 0 
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) 
#define FIRST_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(5000) 
#define NEXT_CONN_PARAMS_UPDATE_DELAY APP_TIMER_TICKS(30000)

this gives very good data transfer rate.

we have developed a fully fuctional WIFI gateway based on nrf52840. the gateway woks fine.all the data is transfered from multiple devices one at a time to the gateway.

now we are developing multiple relays inorder to extend the network capacity of our star prtocol based setup.

our main problem is when the device transfers the data to the relay some packets are lost while tranfering to the gateway i.e we get a response of NRF_ERROR_RESOURCES

i have tried increasing the queue size i.e ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size =20;  but it dosent help much

so i have created a queue by dynamic memory allocation, the data that is received from the device is enqueued and sent to the gateway one by one with the response BLE_GATTS_EVT_HVN_TX_COMPLETE .

this solution has worked till now but when there are more loggers in the network there is a chance of HEAP overflow.

so my solution is if the data logger transfers the data at a lower rate(< 1mbps) there would be less congestion in the relay. how do I achieve this???

Parents
  • Hi,

    our main problem is when the device transfers the data to the relay some packets are lost while tranfering to the gateway i.e we get a response of NRF_ERROR_RESOURCES

    Getting the error NRF_ERROR_RESOURCES does not mean that your packets are lost, it means that the TX buffers are filled up and no free TX buffers are available which based on your next statements seems like you know already.

    i have tried increasing the queue size i.e ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size =20;  but it dosent help much

     Just changing the queue size does not help much if you have a smaller gap_event_length. You need to increase the gap_event_length so that more packets can fit in one connection interval. 

    This is a tedious game of fine tuning the connection_interval/even_length/queue_size/ application memory buffers to give you best performance. And we cannot give any given values as these values differ completely for every application. Try changing the event_length a bit more so that it fits more packets (calculate the event_length based on the maximum length of your packet and how many packets you want to send at once)

    with 75ms max connection interval, you should be able to fit quite a few numbers of packets.

Reply
  • Hi,

    our main problem is when the device transfers the data to the relay some packets are lost while tranfering to the gateway i.e we get a response of NRF_ERROR_RESOURCES

    Getting the error NRF_ERROR_RESOURCES does not mean that your packets are lost, it means that the TX buffers are filled up and no free TX buffers are available which based on your next statements seems like you know already.

    i have tried increasing the queue size i.e ble_cfg.conn_cfg.params.gatts_conn_cfg.hvn_tx_queue_size =20;  but it dosent help much

     Just changing the queue size does not help much if you have a smaller gap_event_length. You need to increase the gap_event_length so that more packets can fit in one connection interval. 

    This is a tedious game of fine tuning the connection_interval/even_length/queue_size/ application memory buffers to give you best performance. And we cannot give any given values as these values differ completely for every application. Try changing the event_length a bit more so that it fits more packets (calculate the event_length based on the maximum length of your packet and how many packets you want to send at once)

    with 75ms max connection interval, you should be able to fit quite a few numbers of packets.

Children
No Data
Related