2017-05-23 05:06 PM
My customer would like to use BTLE as just a 'wire' replacement. However,
we recently discovered that the Android BT stack / Phonegap will sometimes deliver BT packets to our phone-app in a different order to which it received them off the air, so we are forced to add a 1 byte header on each BT packet we transmit from our device to give us the information to reorder them once they are received on the phone.
We would need the ability to add that one byte header on BT packets, and that would have to be inside the BT chip since the packet boundaries are only decided there.
The change is trivial and tiny - I only mention it since this means the code that does the packetization on the BT device cannot be in ROM (OTP or Flash is fine) so we can add this small delta to it.
BTLE (at least in the mode we use it) relays data in 20-byte packets, and so somewhere in the stack the data-stream is broken up into chunks of 20 bytes. We need the code that does that to only take 19 bytes from the data-stream and put that with a 1 byte counter into the 20-byte packet (a very simple change so we can do it ourselves if we have the source code, or it should not take more than 1 hour if someone else does it). I have seen BT chips that store the stack-code in RAM (compiled in with the application) / Flash / OTP / ROM, all of these except ROM would work for us since it would allow the change.
Is this possible with the BLUENRG?
2017-05-24 06:35 AM
Dear Amy,
the source code of ST's Bluetooth Low Energy firmware is not available but you can easily add the 1-byte header at application level on the host (i.e. STM32 or any other MCU that you have).
When you download the software package for ST's BLE solutions, you can find many application examples with full source code available for STM32.
Basically, each time you send data to the smartphone (by updating the value of a characteristic), you can add your 1-byte header.
What ST's BLE product are you using? Based on this information, I can tell you which example application you can modify to add your 1-byte header.
Also, out of curiosity, can you tell me which Phone and Android OS version are you using?
Kind regards,
Antonio
2017-05-24 11:30 AM
HI there,
The 1 byte header cannot be added at the application layer, because the 0-20 byte segmentation of messages happen inside the BT stack and we need each of those segments to have the header. Just to be clear we are not asking for a solution with the change in place, we can make the change ourselves as long as:
We have to support a variety of iPhone and Android OS versions since we don’t control what the end customers will use, the only versions we can exclude are the very early ones that did not have proper BTLE support.
Thank you