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

MAX_CONN_INTERVAL parameter does not work normally

Hi,

I am working on increase data throughput between phone and nrf52832. I am using SDK 15.3.

I create a service and a notify characteristic. I am sending 20-byte packet to phone every EVT_TRANSMIT_RDY interrupt. (Also, i try to send packet every "BLE_GATTS_EVT_HVN_TX_COMPLETE" event instead of EVT_TRANSMIT_RDY.)

For example;

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(500, UNIT_1_25_MS) 
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(1000, UNIT_1_25_MS) 
#define SLAVE_LATENCY 0 
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) 

When my connection settings are like above, "EVT_TRANSMIT_RDY" or "BLE_GATTS_EVT_HVN_TX_COMPLETE" interrupts occurs every two second.

#define MIN_CONN_INTERVAL MSEC_TO_UNITS(50, UNIT_1_25_MS) 
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(100, UNIT_1_25_MS) 
#define SLAVE_LATENCY 0 
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(4000, UNIT_10_MS) /**< Connection supervisory timeout (4 seconds). */

When my connection settings are like above, "EVT_TRANSMIT_RDY" or "BLE_GATTS_EVT_HVN_TX_COMPLETE" interrupts occurs every 200 milisecond.

I have two devices, Xiaomi Mi6 and Samsung T230 tablet. And both of them works same. What is the problem of my code? (The code is BLE_APP_TEMPLATE example.)

Aditionally, The nRF52832 on the other hand can send up to 6 packets per interval. However, "BLE_GATTS_EVT_HVN_TX_COMPLETE" event occurs every MAX_CONN_INTERVAL*2
and i can only send one packet per interval. How to send up to 6 packet per interval?

Thank you.

  • How are you calling sd_ble_gatts_hvx()? 

    The number of Handle Value Notifications that can be queued is configured by ble_gatts_conn_cfg_t::hvn_tx_queue_size. The queue size is by default set to 1, see BLE_GATTS_HVN_TX_QUEUE_SIZE_DEFAULT in ble_gatts.h. You can increase the HVN TX queue by calling sd_ble_cfg_set() with BLE_CONN_CFG_GATTS and setting the ble_conn_cfg_t::ble_gatts_conn_cfg_t::hvn_tx_queue_size. 

    When the queue is full, the function call will return NRF_ERROR_RESOURCES  and a BLE_GATTS_EVT_HVN_TX_COMPLETE event will be issued as soon as the transmission of the notification is complete.

    The application can keep track of the available queue element count for notifications by following the procedure below:
     - Store initial queue element count in a variable.
     - Decrement the variable, which stores the currently available queue element count, by one when a call to this function returns  NRF_SUCCESS.
     - Increment the variable, which stores the current available queue element count, by the count variable in  BLE_GATTS_EVT_HVN_TX_COMPLETE event.

    If you do not see 6 HVN packets being sent after filling up the queue, then you can try to adjust the NRF_SDH_BLE_GAP_EVENT_LENGTH in sdk_config.h

    Best regards

    Bjørn 

  • Thank you for your response. I will try your suggestion and inform you.

  • Great. Let me know of you run into any issues. 

    -Bjørn

  • Note that the Central is not bound to grant Connection Interval settings that you request!

    Have you checked what settings are actually being granted?

Related