jrowberg / bglib

BGLib implementation for Bluegiga BLE Bluetooth Smart modules
Other
240 stars 170 forks source link

How to access CRC? #37

Closed jmuellers closed 7 years ago

jmuellers commented 7 years ago

Working on a BLE121LR project, I got user feedback of very rare occasions of corrupted data. After analysis I came to the conclusion that it must be bit flip errors in the transmission. I understand BTLE does not have FEC. But I see that a CRC is included in each packet.

By which mechanism can the CRC be accessed? When receiving the packet, how do I know whether it passed CRC?

jrowberg commented 7 years ago

There is no way to access CRC data at the API/BGScript layer. The controller hardware and host stack built in are designed so that any packet not passing a CRC check is rejected and never reaches the upper layers of the stack. I have never encountered a data integrity problem due to CRC issues with data flowing in either direction. In every case where unexpected data occurred, the problem was due to hardware serial transfer logic/voltage problems (e.g. UART clock mismatch) or buffer overflow (BLE1xx modules have only a 1-byte hardware FIFO).

jmuellers commented 7 years ago

Dear Jeff, thank you for the clarification, I wasn't aware that it is handled on such a low level. In this case, you are right, it must be a problem on the hardware, either on some serial transfer, or in my case even a SEU in cache/memory. Best regards Johannes