How to reduce BLE notification latency
I'm evaluating the STM32WB55 for use in a product which needs to read user input (button press and associated sensor data), and communicate it to another device over BLE.
I'm using a pair of STM32WB55 Nucleo boards to communicate with each other over BLE. I'm using the BLE_p2pClient and BLE_p2pServer example programs as a starting point. I would like to reduce the latency as much as possible for sending notifications between the 2 boards. Currently, I'm able to start both boards and establish a connection between them. The example code is designed such that when you press a button on one board, an LED on the other board changes state. Using a logic analyzer to measure the delay between the button press and the LED changing, I'm seeing times that range from ~70ms to 150 ms. I'm trying to understand what parameters can be changed within the code to affect this time. I see that BLE has a connection interval spec that can range from 7.5ms to 4s. I believe this corresponds to the CONN_P1 and CONN_P2 macros in app_conf.h. However, when I change these from 50 and 100 to 7.5 and 10 on the BLE_p2pClient side, I don't see any affect on the time between a button press and an LED change.
So, several questions -
- Are these the right example programs to start with?
- Does CONN_P1 and CONN_P2 represent the connection interval?
- Are there other parameters that I can change in order to reduce the time between a button press on one device and the corresponding LED change on the other device?
- What is the lowest latency I can expect to see using this hardware?
My goal is to get to a system with a minimum latency, as well as to understand the resulting affect on battery life this would have.
Thanks!
Brian