Problems in Setting Connection Interval


#1

Hello Everyone,

I hope you all are in good health.

I am using Redbear Nano v1.5 to transmit EMG signals from the human body to the computer using two Ble Nano modules. Even though I understand that the signal sampling period is very slow, I wanted to sample the signal as quickly as possible. I am using the Arduino IDE, and it has only been three weeks that I have been using BLE.

I have been consulting the forums, but still I have found the solution to the problem of setting the connection interval. I am using the code below in the void setup of the BLE_SimplePeripheral.

void setup()
{
Serial.begin(9600);
Serial.println("Start ");
ble.init();

Gap::ConnectionParams_t connectionParams;
connectionParams.minConnectionInterval = 12;
connectionParams.maxConnectionInterval = 12;
connectionParams.slaveLatency = 0;
connectionParams.connectionSupervisionTimeout = 500;
ble.gap().setPreferredConnectionParams(&connectionParams);

ble.onConnection(connectionCallBack);
ble.onDisconnection(disconnectionCallBack);
ble.onDataWritten(gattServerWriteCallBack);
ble.onDataSent(gattServerSentCallBack);

setAdvertisement();
// set adv_type(enum from 0)
// ADV_CONNECTABLE_UNDIRECTED
// ADV_CONNECTABLE_DIRECTED
// ADV_SCANNABLE_UNDIRECTED
// ADV_NON_CONNECTABLE_UNDIRECTED
ble.setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
// add service
dfuService = new DFUService(ble);
hrService = new HeartRateService(ble, hrmCounter, HeartRateService::LOCATION_FINGER);
deviceInfo = new DeviceInformationService(ble, “ARM”, “Model1”, “SN1”, “hw-rev1”, “fw-rev1”, “soft-rev1”);
ble.addService(uartService);
// set device name
ble.setDeviceName((const uint8_t *)DEVICE_NAME);
// set tx power,valid values are -40, -20, -16, -12, -8, -4, 0, 4
ble.setTxPower(4);
// set adv_interval, 100ms in multiples of 0.625ms.
ble.setAdvertisingInterval(160);
// set adv_timeout, in seconds
ble.setAdvertisingTimeout(0);
// ger BLE stack version
Serial.print("BLE stack verison is : ");
Serial.println(ble.getVersion());
// start advertising
ble.startAdvertising();
Serial.println("start advertising ");
}

It can be seen that I attempt to change the connection interval of the device. However, while monitoring using the CentralTest, both Min and Max ConnectionIntervals are set to 64. I would be very grateful for your responses. I must say that during my engineering, I was only trained in simple microcontroller C programming and not intricate data structures.

I will be awaiting your responses.

Zahak