Hello everyone,
I am new here joined to ask about RFM95.
My project is having trouble receiving incoming packets with RFM95, I use Sandeep Mistry (sandeepmistry (Sandeep Mistry) · GitHub) library.
My settings are:
LoRa.setPreambleLength(8);
LoRa.setCodingRate4(5);
LoRa.enableCrc();
LoRa.setSpreadingFactor(12);
LoRa.setSignalBandwidth(7.8E3);
LoRa.setTxPower(20);
A packet is received every 5s and I have errors from time to time. I think I have 2 issues.
One is that it seems that RFM95 CRC for payload, is really bad at catching bit errors. This is what was sent:
Time: Monday, 7:2:36
, Temperature = 25.00*C Humidity = 54.00%,
Tx: 2F 6C 21 72 E AC F7 AD 3C EB 36 C4 19 ED 86 50
sending packet: 4537
This is what was received:
Time: Monday, 7:2:36
, received packet, bytes available:16
Rx: 2F CC 21 72 E AC F7 AD 3C EB 36 C4 19 ED 86 50
->~&}Œð*lda—„¼Ú`/Ì!r¬÷<ë6Äí†PæÿÿÿZoV' with RSSI -26
The error is in the 2nd byte received. Did you also experience this?
Second issue is that sometimes reading the data, it looks like I don't get entire packet, altough this might simply be error in last byte (receiving 0x00 instead of 0x2E).
I use this code to read data from RFM95:
while (LoRa.available()) {
String LoRaData = LoRa.readString();
What I send:
Time: Monday, 7:0:51
, Temperature = 24.90*C Humidity = 54.20%,
Tx: 9 78 94 A7 9C F4 89 33 14 B6 1F E7 B0 4F 0 2E
sending packet: 4516
What I receive:
Time: Monday, 7:0:51
, received packet, bytes available:16
Rx: 9 78 94 A7 9C F4 89 33 14 B6 1F E7 B0 4F 0 0
->º…9Æ8×½^ößr x”§œô‰3¶ç°O' with RSSI -27
Here either not full packet was read from RFM95, even though all 16 bytes were available OR the last byte was received wrong, and RFM payload CRC did not catch it again. Is there something I am not aware about the .readString() function or the RFM95?
Is there any info about the CRC algorithm used for payload on RFM95? -> Datasheet page 72. CCIT T & IBM.
Any insight will be highly appreciated.
EDIT: I have found in datasheet of RFM95 CRC implementation. I copied into arduino and calculated the result for first example of Tx and Rx packet. I did it for both possible variants of CRC algorithm used, and both should be able to catch the error.
Payload data for CRC Tx: 2F 6C 21 72 E AC F7 AD 3C EB 36 C4 19 ED 86 50.
Payload data for CRC Rx: 2F CC 21 72 E AC F7 AD 3C EB 36 C4 19 ED 86 50
Resulting CRC:
CCITT
Tx: 0xDF66
Rx: 0x1660
IBM
Tx: 0xB7FB
Rx: 0x143B
But for some reason, the packet is received as there is no CRC error. I am at a loss. Please help.