Best starting point to minimize BLE delays
I need to develop an STM32WB55-based BLE system that consists of 2 parts. Each part will have a button on it as well as a sensor. When a button is pressed on one device, it needs to inform the other device, as well as communicate its sensor value. Both devices are identical. I need to communicate information between the devices upon a button press as quickly as possible, and I also need to preserve battery life. Here are my thoughts on this so far -
- Both devices are configured as peripherals.
- Both devices advertise periodically
- When a button is pressed on Device 1, it switches its role to central (is this possible?)
- Device 1 scans for a peripheral, sees Device 2 and connects to it.
- Device 1 sends its button and sensor data to Device 2
- The devices disconnect and both devices go back to peripheral mode and advertising.
Several questions -
- Is the scenario described above feasible?
- If so, should I use a standard profile or a proprietary profile? Is there a performance penalty using one of these compared to another?
- Is there a good example program to start with that would minimize the new code development required?
I have played with the BLE_p2pServer and BLE_p2pClient programs on the WB55 Nucleo boards. I'm seeing a connection time of 10-12 seconds using this code, although much of this appears to be in the discovery phase. Is this typical for establishing a connection between 2 devices? What can I do to reduce this time?
I'm hoping for a time of around 300 ms from the time a button is pressed, until the time the other device is notified of this event. This 300 ms needs to cover both the time to connect the devices as well as the data transfer.
Is this possible using BLE on the WB55 hardware?
Thanks...
Brian