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

data dose not sent with specified connection interval

Hi to all,

i am developing a device with nrf51822 soc, i want to read some data from flash storage of nrf51822 then forward it on ble, i implemented a code for this job but i can not receive the data with specified connection interval, the connection parameters configured as below:

gap_conn_params.min_conn_interval = MSEC_TO_UNITS(25, UNIT_1_25_MS);
gap_conn_params.max_conn_interval = MSEC_TO_UNITS(25, UNIT_1_25_MS);
gap_conn_params.slave_latency     = SLAVE_LATENCY;
gap_conn_params.conn_sup_timeout  = MSEC_TO_UNITS(1000, UNIT_1_25_MS);

as you can see the connection interval was set to 25ms, but i am receiving the data on central device with 1 packet per 50ms rate. the process is in this manner that at first i send a packet(20 byte) on notification char, and then i send next 20 byte when i received the BLE_EVT_TX_COMPLETE event. each time i receive BLE_EVT_TX_COMPLETE i try to open a record from flash storage, then i read 20 Byte from flash and then i try to close the record. and also i am using the notification charactristic to transfer data. and also when i change the connection interval to 50ms, the speed of data transfer change to one packet per 100ms.

now any can give me a advice to read 20 byte data from flash and then forward it on bluetooth on each connection interval.

thanks.

Parents Reply Children
  • after BLE_EVT_TX_COMPLETE i call a function, in this function i call fds_record_find & fds_record_open function to open a flash record to read, then i copy 20Byte content from opened record to an array and then i put an task in queue with app_sched_event_put function, when the task started i call sd_ble_gatts_hvx() function to send data over bluetooth and again i wait for BLE_EVT_TX_COMPLETE event to start the process again.

    i gave also other question, if i change charactristic type from notification to indication it can help to make performance better?? in central i have a limit that can receive only one packet at a time, what happen if i change char type to indication and queue six packet in ble stack to send it one by one in each connection interval.

    thanks for your response.

  • I don't see any benefits of adding sd_ble_gatts_hvx() to the app scheduler queue, I'd suggest to call it as soon as you've read out the data from flash. sd_ble_gatts_hvx() adds the notification packet to the softdevice's internal scheduler queue.

    As a test, please try to always keep more than one packet queued in the softdevice scheduler and check if the central is receiving one packet for every connection event in that case.

    Indications are significantly slower because the central needs to acknowledge each packet with 'ATT handle value confirmation'. 

Related