Go Down

Topic: Adjust Arduino 101 Bluetooth Package Interval (Read 576 times) previous topic - next topic

relicwang

Hello!
 
I am trying to send a file from Arduino 101 to the Android phone via Bluetooth. But I notice that the package interval is around 100 ms when I enable the BLE notification while  transfering the data.
 
Later, I tried to check the ble_client.h library to adjust the default interval parameters as below:
 
#define DEFAULT_MIN_CONN_INTERVAL MSEC_TO_UNITS(12, UNIT_1_25_MS)
#define DEFAULT_MAX_CONN_INTERVAL MSEC_TO_UNITS(15, UNIT_1_25_MS)
 
#define MIN_CONN_INTERVAL 0x0006
#define MAX_CONN_INTERVAL 0x0015
 
I did receive lower interval for BLE broadcasting, but when I start to transmit the data (with BLE notification enabled), it increases to 98ms. Does anyone have any idea about it?
 
Thanks in advance!

relicwang

For those who comes later, after you adjust the min, max interval. you will need to adjust the resolution accordingly. Please refer the code below. And the current shortest interval I could retrieve is 30ms, whick could lead to around 666 Bytes/second.


enum {
   UNIT_0_200_MS = 200,                            /**< Number of microseconds in 0.200 milliseconds. */
        UNIT_0_625_MS = 625,                            /**< Number of microseconds in 0.625 milliseconds. */
   UNIT_1_MS = 1000,                               /**< Number of microseconds in 1 milliseconds. */
        UNIT_1_25_MS = 1250,                            /**< Number of microseconds in 1.25 milliseconds. */
        UNIT_10_MS = 10000                              /**< Number of microseconds in 10 milliseconds. */
};

#define MSEC_TO_UNITS(TIME, RESOLUTION) (((TIME) * 1000) / (RESOLUTION))

/* Connection parameters used for Peripheral Preferred Connection Parameterss (PPCP) and update request */
#define DEFAULT_MIN_CONN_INTERVAL MSEC_TO_UNITS(5, UNIT_0_625_MS)
#define DEFAULT_MAX_CONN_INTERVAL MSEC_TO_UNITS(10, UNIT_0_625_MS)

#define MIN_CONN_INTERVAL 0x0005
#define MAX_CONN_INTERVAL 0x000a

Go Up