Issues with RFM95 receiving

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.

Upon further investigation, it seems that the CRC is not enabled by enableCRC() function. Here is a dump of the registers after configuration:

0x0: 0x27
0x1: 0x81
0x2: 0x1A
0x3: 0xB
0x4: 0x0
0x5: 0x52
0x6: 0xD8
0x7: 0x80
0x8: 0x0
0x9: 0x8F
0xA: 0x9
0xB: 0x2B
0xC: 0x23
0xD: 0x1
0xE: 0x0
0xF: 0x0
0x10: 0x0
0x11: 0x0
0x12: 0x0
0x13: 0x0
0x14: 0x0
0x15: 0x0
0x16: 0x0
0x17: 0x0
0x18: 0x10
0x19: 0x0
0x1A: 0x0
0x1B: 0x0
0x1C: 0x0
0x1D: 0x72
0x1E: 0x70
0x1F: 0x64
0x20: 0x0
0x21: 0x8
0x22: 0x1
0x23: 0xFF
0x24: 0x0
0x25: 0x0
0x26: 0x4
0x27: 0x0
0x28: 0x0
0x29: 0x0
0x2A: 0x0
0x2B: 0x0
0x2C: 0x0
0x2D: 0x50
0x2E: 0x14
0x2F: 0x45
0x30: 0x55
0x31: 0xC3
0x32: 0x5
0x33: 0x27
0x34: 0x1C
0x35: 0xA
0x36: 0x3
0x37: 0xA
0x38: 0x42
0x39: 0xF3
0x3A: 0x49
0x3B: 0x1D
0x3C: 0x0
0x3D: 0xAF
0x3E: 0x0
0x3F: 0x0
0x40: 0x0
0x41: 0x0
0x42: 0x12
0x43: 0x24
0x44: 0x2D
0x45: 0x0
0x46: 0x3
0x47: 0x0
0x48: 0x4
0x49: 0x23
0x4A: 0x0
0x4B: 0x9
0x4C: 0x5
0x4D: 0x84
0x4E: 0x32
0x4F: 0x2B
0x50: 0x14
0x51: 0x0
0x52: 0x0
0x53: 0x11
0x54: 0x0
0x55: 0x0
0x56: 0x0
0x57: 0xF
0x58: 0xE0
0x59: 0x0
0x5A: 0xC
0x5B: 0x0
0x5C: 0x6
0x5D: 0x0
0x5E: 0x5C
0x5F: 0x78
0x60: 0x0
0x61: 0x1C
0x62: 0xE
0x63: 0x5B
0x64: 0xCC
0x65: 0x0
0x66: 0x1
0x67: 0x50
0x68: 0x0
0x69: 0x0
0x6A: 0x0
0x6B: 0x0
0x6C: 0x0
0x6D: 0x0
0x6E: 0x0
0x6F: 0xB
0x70: 0xD0
0x71: 0x0
0x72: 0x13
0x73: 0x0
0x74: 0x0
0x75: 0x0
0x76: 0x0
0x77: 0x0
0x78: 0x0
0x79: 0x0
0x7A: 0x0
0x7B: 0x0
0x7C: 0x0
0x7D: 0x0
0x7E: 0x0
0x7F: 0x0

Turns out the info on the interwebs was wrong about first setting register and then performing an init. As I did a manual reset first, then initialised RFM95 and then changed parameter (turn ON CRC) the thing started working.

Issue on github, same poster.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.