Hi,
We are working on BLE Multi sensor synchronization. In that one is master Sensor & others 2 are slaves. We are using CC2541 & stack version is BLE-CC254x-1.4.2.2.
We explored 2 methods.
Method 1: peripheral+Broadcaster, peripheral+ Observer
Method 2:Central, peripheral
Data packet length is 8 byte.
Method 1
Master sensor is in Peripheral + Broadcaster role
Slave sensors are in Peripheral + Observer role.
Master BLE will broadcast the message to other Slaves based on the external trigger input.
Master BLE will advertise when it is required to send information to observer in non connectable method.
The minimum advertising interval of non connectable advertise is 100ms.
To avoid the data loss, same trigger information will advertise 3 times.
For optimize the non connectable advertise time, We are enabling & disabling the Advertise for 3 times.
After following the above step, we could able to receive data in slave around 7-9ms in 1st attempt , 15-18ms in 2nd time and having data loss
Observer settings are as follows
// Maximum number of scan responses
#define DEFAULT_MAX_SCAN_RES 16
// Scan duration in ms
#define DEFAULT_SCAN_DURATION 4000
// Discovey mode (limited, general, all)
#define DEFAULT_DISCOVERY_MODE DEVDISC_MODE_ALL
// TRUE to use active scan
#define DEFAULT_DISCOVERY_ACTIVE_SCAN FALSE
// TRUE to use white list during discovery
#define DEFAULT_DISCOVERY_WHITE_LIST FALSE
GAP_SetParamValue( TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION );
// GAP_SetParamValue( TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION );
GAP_SetParamValue( TGAP_GEN_DISC_SCAN_INT, 16);
GAP_SetParamValue( TGAP_GEN_DISC_SCAN_WIND, 16);
GAP_SetParamValue(TGAP_FILTER_ADV_REPORTS,FALSE);
Problem:
How we can avoid the data loss in method1.
Method2
Master BLE is in Central role
Slave BLE is in Peripheral role.
Master BLE will connect to 2 peripheral when it is powered on. 2 Peripheral MAC address are hard coded.
We have measured the timings in BLE-CC254x-1.4.0 stack
Below are the timing details
Connection interval 7ms. Advertising interval is 62ms
Method 2 |
Master Sensor1 ms |
Sensor2ms |
Sensor3 ms |
TEST1 Started sampling in |
0 |
23 |
30 |
TEST2 Started sampling in |
0 |
72 |
79 |
TEST3 Started sampling in |
0 |
42 |
48 |
TEST4 Started sampling in |
0 |
15 |
20 |
TEST5 Started sampling in |
0 |
90 |
100 |
TEST6 Started sampling in |
0 |
10 |
103 |
TEST7 Started sampling in |
0 |
30 |
140 |
Connection interval 7ms. Advertising interval is 20 ms
Method 2 |
Master Sensor1 ms |
Sensor2ms |
Sensor3 ms |
TEST1 Started sampling in |
0 |
35 |
90 |
TEST2 Started sampling in |
0 |
35 |
90 |
TEST3 Started sampling in |
0 |
110 |
165 |
TEST4 Started sampling in |
0 |
25 |
80 |
TEST5 Started sampling in |
0 |
45 |
190 |
TEST6 Started sampling in |
0 |
35 |
80 |
TEST7 Started sampling in |
0 |
35 |
75 |
-
How to reduce the data transmission time.
-
Is it possible to send the same data to 2 peripherals at a time. Whether 2 peripheral will receive the message at a same time.
-
How to synchronize the timings between 3 device.
Other issues
-
BLE device is not advertising after some time which advertise before. Even after power reset device is in same state. We have seen that after re-flashing the device is coming up.
-
BLE device has paired with Android device. We have observed that the communication is not happening after some time. To workaround we unpaired & paired the device again. For your information, We are using BLE-CC254x-1.4.2.2.
Regards,
Kayathri