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???