PROBLEM: Currently the Tympan BLE firmware must maintain a delay of at least ~12 msec between each 24-byte data packet or else the remote device (phone/tablet) fails to get all the data. (Beware that the 12 msec is an approximate value obtained through anecdotal testing. Our long-standing value is 24 msec. The real answer could be 12 msec, or it could something between 12 and 24.)
CAUSE: We do not know the cause for certain. Originally, it was assumed to be the baud rate between the Tympan processor and the BLE module, but as the baud rate is 115200, a 24-byte packet (using 8-N-1 UART comms) should only require (8+1)*24 / 115200 = 1.9 msec, not 12. So, something else is causing the need for the delay. Is it some latency in my BLE firmware on the BLE module? Is it some latency in the underlying nRF firmware on the BLE module? Is it some latency in the RF comms? Is it some latency in the servicing by the remote device (phone/tablet)?
WORKAROUND: Even though we don't know why we need this delay, let's accept that we do need it. Let's move the implementation of this delay out of the Tympan BLE library and move it into the BLE module itself. This requires us to add deep buffering to the BLE module, but it will allow us to free up the Tympan module to do other work.
BLE FIRMWARE REVISION: Here are the features of the revision required to the BLE module's firmware:
- Enlarge the buffering of in-coming data from the Tympan.
- This can be implemented either by a deeper buffer of the raw in-coming bytes
- Or, it can be implemented as buffer of formatted ready-to-go BLE messages (whatever that means)
- Add a delay between transferring each data packet to the underlying nRF firmware
- The default "connection interval" for iOS is slower than android, so set the default delay to 15 msec
- We believe that the connection interval is negotiated during connection so, ideally, we'd adapt the delay to match the connection interval
- Add a SET option to the firmware to allow the user to change the value of the delay
- Add a GET option to the firmware to allow the user to query the space remaining in the deep buffer
TYMPAN BLE LIBRARY REVISION:
- For the nRF52 portion of the BLE library (not the legacy portions that support the older modules), remove the delay() statements
- For the nRF52 portion of the BLE library, add support for the new GET/SET options added above
TABLET/PHONE APP REVISIONS:
Tag @cab-creare-com , @eyuan-creare
PROBLEM: Currently the Tympan BLE firmware must maintain a delay of at least ~12 msec between each 24-byte data packet or else the remote device (phone/tablet) fails to get all the data. (Beware that the 12 msec is an approximate value obtained through anecdotal testing. Our long-standing value is 24 msec. The real answer could be 12 msec, or it could something between 12 and 24.)
CAUSE: We do not know the cause for certain. Originally, it was assumed to be the baud rate between the Tympan processor and the BLE module, but as the baud rate is 115200, a 24-byte packet (using 8-N-1 UART comms) should only require (8+1)*24 / 115200 = 1.9 msec, not 12. So, something else is causing the need for the delay. Is it some latency in my BLE firmware on the BLE module? Is it some latency in the underlying nRF firmware on the BLE module? Is it some latency in the RF comms? Is it some latency in the servicing by the remote device (phone/tablet)?
WORKAROUND: Even though we don't know why we need this delay, let's accept that we do need it. Let's move the implementation of this delay out of the Tympan BLE library and move it into the BLE module itself. This requires us to add deep buffering to the BLE module, but it will allow us to free up the Tympan module to do other work.
BLE FIRMWARE REVISION: Here are the features of the revision required to the BLE module's firmware:
TYMPAN BLE LIBRARY REVISION:
TABLET/PHONE APP REVISIONS:
Tag @cab-creare-com , @eyuan-creare