ble-x-nucleo-idb0xa1 icon indicating copy to clipboard operation
ble-x-nucleo-idb0xa1 copied to clipboard

How to change the BLE send data interval ?

Open dadiliebian opened this issue 7 years ago • 5 comments

                about 100ms     about 100ms
 [1 data]-interval -[2 data]-interval-[3 data]  --------------

First data and second data of interval is about 100ms by BLE.

How to reduce the interval in each data sned?

dadiliebian avatar Jul 17 '17 07:07 dadiliebian

@thegecko @danros

dadiliebian avatar Jul 17 '17 07:07 dadiliebian

Hello, I think i may be able to help but we need more precision about your issue.

What function do you use to send data ? what is the length of the data ? Do you send data using a gatt characteristic ?

Pierre-Marie

pmancele avatar Jul 19 '17 11:07 pmancele

yes , the ble pack's length 20 bytes and use the characteristic to send data.I wish reduce the interval.The interval is about 100ms.

dadiliebian avatar Jul 26 '17 14:07 dadiliebian

You can request a connection update from the peripheral, by calling the updateConnectionParams. For example:

	BLE &ble = BLE::Instance();
	if (ble.getGapState().connected) {
	    gap_params.connectionSupervisionTimeout = 500;
	    gap_params.minConnectionInterval = 16;
	    gap_params.maxConnectionInterval = 20;
	    gap_params.slaveLatency = 0;

	    if (ble.gap().updateConnectionParams(gap_h, &gap_params) == BLE_ERROR_NONE) {
	    	printf("Request a connection params update!\n");
	    }
	}

pmancele avatar Jul 26 '17 15:07 pmancele

Thank you @pmancele

dadiliebian avatar Jul 28 '17 07:07 dadiliebian