sandeepmistry / arduino-LoRa

An Arduino library for sending and receiving data using LoRa radios.
MIT License
1.61k stars 620 forks source link

Receiver hangs up after random time interval #447

Open romigr opened 3 years ago

romigr commented 3 years ago

When I run the sketches in this tutorial https://randomnerdtutorials.com/esp32-lora-rfm95-transceiver-arduino-ide/ on the TTGO LoRa32 – OLED V1 boards, everything works perfectly at first. However, after a “random” period of between 30 minutes and 11 hours, the receiver device hangs up. The transmitter continues to run and after resetting the receiver, transmission and reception resumes for another unpredictable period. I have also run the sketches with the Heltec WiFi LoRa 32 (V2) with exactly the same result. In addition, the sketches from https://randomnerdtutorials.com/esp32-lora-sensor-web-server/ run well with both boards – for a while; then the receivers hang. Do you have any suggestions for me? Thanks…

IoTThinks commented 3 years ago

I have no problem receiving packets for months with esp32+Ai-Thinker/RFM95. You can try to use the receiver at https://github.com/sandeepmistry/arduino-LoRa/blob/master/examples/LoRaReceiverCallback/LoRaReceiverCallback.ino

You need to set the pins, too. https://github.com/sandeepmistry/arduino-LoRa/blob/master/API.md#set-pins

peringek commented 3 years ago

Did you solve this problem ? I have the same issue. ESP32, RFM95W, lab setup with short distance and good rssi. Could it be a hw-problem? I see that the DIO0 pin on the radio module goes high for 100uSecs or so when it receives a package. When the receiver hangs up this signal remains low. It is still possible to communicate with it and I am trying to see if there are any registers that would explain what has happened. So far with no luck. When using one transmitter, and two receivers, both receivers will freeze at random times. But not at the same time. I also find that if I transmit with short intervals (150 mSec) there tends to be more frequent receiver hang-ups than when I use longer intervals (Once every 30 secs or so.) My payload is 9 chars. Here is a dump of the registers when the receiver has stopped, And after I reset and initialize it again.

[2021-04-27 22:33:11.090] 0000; Time ;00:03:03; To: 200 From: 203 ID: 189 Size: 9 [10][0][3][140][0][225] [2021-04-27 22:33:22.818] Dumpreg before resets: [2021-04-27 22:33:22.821] 0x0: 0xCB [2021-04-27 22:33:22.821] 0x1: 0x86 [2021-04-27 22:33:22.821] 0x2: 0x1A [2021-04-27 22:33:22.821] 0x3: 0xB [2021-04-27 22:33:22.824] 0x4: 0x0 [2021-04-27 22:33:22.824] 0x5: 0x52 [2021-04-27 22:33:22.824] 0x6: 0x6C [2021-04-27 22:33:22.824] 0x7: 0x40 [2021-04-27 22:33:22.825] 0x8: 0x0 [2021-04-27 22:33:22.825] 0x9: 0x8F [2021-04-27 22:33:22.825] 0xA: 0x9 [2021-04-27 22:33:22.826] 0xB: 0x2B [2021-04-27 22:33:22.827] 0xC: 0x23 [2021-04-27 22:33:22.830] 0xD: 0x1 [2021-04-27 22:33:22.831] 0xE: 0x0 [2021-04-27 22:33:22.831] 0xF: 0x0 [2021-04-27 22:33:22.831] 0x10: 0x0 [2021-04-27 22:33:22.858] 0x11: 0x0 [2021-04-27 22:33:22.858] 0x12: 0x0 [2021-04-27 22:33:22.858] 0x13: 0x9 [2021-04-27 22:33:22.902] 0x14: 0x0 [2021-04-27 22:33:22.902] 0x15: 0x44 [2021-04-27 22:33:22.902] 0x16: 0x0 [2021-04-27 22:33:22.902] 0x17: 0x42 [2021-04-27 22:33:22.902] 0x18: 0x20 [2021-04-27 22:33:22.902] 0x19: 0x10 [2021-04-27 22:33:22.902] 0x1A: 0x5E [2021-04-27 22:33:22.902] 0x1B: 0x40 [2021-04-27 22:33:22.902] 0x1C: 0x41 [2021-04-27 22:33:22.902] 0x1D: 0x72 [2021-04-27 22:33:22.902] 0x1E: 0x74 [2021-04-27 22:33:22.902] 0x1F: 0x64 [2021-04-27 22:33:22.902] 0x20: 0x0 [2021-04-27 22:33:22.902] 0x21: 0x8 [2021-04-27 22:33:22.902] 0x22: 0x1 [2021-04-27 22:33:22.902] 0x23: 0xFF [2021-04-27 22:33:22.902] 0x24: 0x0 [2021-04-27 22:33:22.902] 0x25: 0x9 [2021-04-27 22:33:22.902] 0x26: 0x4 [2021-04-27 22:33:22.902] 0x27: 0x0 [2021-04-27 22:33:22.902] 0x28: 0xF [2021-04-27 22:33:22.902] 0x29: 0x96 [2021-04-27 22:33:22.902] 0x2A: 0xC0 [2021-04-27 22:33:22.902] 0x2B: 0x0 [2021-04-27 22:33:22.902] 0x2C: 0x12 [2021-04-27 22:33:22.952] 0x2D: 0x50 [2021-04-27 22:33:22.952] 0x2E: 0x14 [2021-04-27 22:33:22.952] 0x2F: 0x45 [2021-04-27 22:33:22.952] 0x30: 0x55 [2021-04-27 22:33:22.952] 0x31: 0xC3 [2021-04-27 22:33:22.952] 0x32: 0x5 [2021-04-27 22:33:22.952] 0x33: 0x27 [2021-04-27 22:33:22.952] 0x34: 0x1C [2021-04-27 22:33:22.952] 0x35: 0xA [2021-04-27 22:33:22.952] 0x36: 0x3 [2021-04-27 22:33:22.952] 0x37: 0xA [2021-04-27 22:33:22.952] 0x38: 0x42 [2021-04-27 22:33:22.952] 0x39: 0x32 [2021-04-27 22:33:22.952] 0x3A: 0x52 [2021-04-27 22:33:22.952] 0x3B: 0x1D [2021-04-27 22:33:22.952] 0x3C: 0x0 [2021-04-27 22:33:22.952] 0x3D: 0xAF [2021-04-27 22:33:22.952] 0x3E: 0x0 [2021-04-27 22:33:22.952] 0x3F: 0x0 [2021-04-27 22:33:22.952] 0x40: 0x0 [2021-04-27 22:33:22.952] 0x41: 0x0 [2021-04-27 22:33:22.952] 0x42: 0x12 [2021-04-27 22:33:22.952] 0x43: 0x24 [2021-04-27 22:33:22.952] 0x44: 0x2D [2021-04-27 22:33:22.952] 0x45: 0x0 [2021-04-27 22:33:22.952] 0x46: 0x3 [2021-04-27 22:33:22.952] 0x47: 0x0 [2021-04-27 22:33:22.952] 0x48: 0x4 [2021-04-27 22:33:22.952] 0x49: 0x23 [2021-04-27 22:33:22.952] 0x4A: 0x0 [2021-04-27 22:33:22.952] 0x4B: 0x9 [2021-04-27 22:33:22.952] 0x4C: 0x5 [2021-04-27 22:33:22.952] 0x4D: 0x84 [2021-04-27 22:33:22.952] 0x4E: 0x32 [2021-04-27 22:33:22.952] 0x4F: 0x2B [2021-04-27 22:33:22.952] 0x50: 0x14 [2021-04-27 22:33:22.952] 0x51: 0x0 [2021-04-27 22:33:22.952] 0x52: 0x0 [2021-04-27 22:33:22.952] 0x53: 0x10 [2021-04-27 22:33:22.952] 0x54: 0x0 [2021-04-27 22:33:22.952] 0x55: 0x0 [2021-04-27 22:33:22.952] 0x56: 0x0 [2021-04-27 22:33:22.952] 0x57: 0xF [2021-04-27 22:33:22.952] 0x58: 0xE0 [2021-04-27 22:33:22.952] 0x59: 0x0 [2021-04-27 22:33:22.952] 0x5A: 0xC [2021-04-27 22:33:22.952] 0x5B: 0xF0 [2021-04-27 22:33:22.952] 0x5C: 0x6 [2021-04-27 22:33:22.992] 0x5D: 0x0 [2021-04-27 22:33:22.992] 0x5E: 0x5C [2021-04-27 22:33:22.992] 0x5F: 0x78 [2021-04-27 22:33:22.992] 0x60: 0x0 [2021-04-27 22:33:22.992] 0x61: 0x1C [2021-04-27 22:33:22.992] 0x62: 0xE [2021-04-27 22:33:22.992] 0x63: 0x5B [2021-04-27 22:33:22.992] 0x64: 0xCC [2021-04-27 22:33:22.992] 0x65: 0x0 [2021-04-27 22:33:22.992] 0x66: 0x1 [2021-04-27 22:33:22.992] 0x67: 0x50 [2021-04-27 22:33:22.992] 0x68: 0x0 [2021-04-27 22:33:22.992] 0x69: 0x0 [2021-04-27 22:33:22.992] 0x6A: 0x0 [2021-04-27 22:33:22.992] 0x6B: 0x0 [2021-04-27 22:33:22.992] 0x6C: 0x0 [2021-04-27 22:33:22.992] 0x6D: 0x0 [2021-04-27 22:33:22.992] 0x6E: 0x0 [2021-04-27 22:33:22.992] 0x6F: 0xB [2021-04-27 22:33:22.992] 0x70: 0xD0 [2021-04-27 22:33:22.992] 0x71: 0x0 [2021-04-27 22:33:22.992] 0x72: 0x13 [2021-04-27 22:33:22.992] 0x73: 0x0 [2021-04-27 22:33:22.992] 0x74: 0x0 [2021-04-27 22:33:22.992] 0x75: 0x0 [2021-04-27 22:33:22.992] 0x76: 0x0 [2021-04-27 22:33:22.992] 0x77: 0x0 [2021-04-27 22:33:22.992] 0x78: 0x0 [2021-04-27 22:33:22.992] 0x79: 0x0 [2021-04-27 22:33:22.992] 0x7A: 0x0 [2021-04-27 22:33:22.992] 0x7B: 0x0 [2021-04-27 22:33:22.992] 0x7C: 0x0 [2021-04-27 22:33:22.992] 0x7D: 0x0 [2021-04-27 22:33:22.992] 0x7E: 0x0 [2021-04-27 22:33:22.992] 0x7F: 0x0 [2021-04-27 22:33:22.992] -END LORA DumReg- [2021-04-27 22:33:23.031] LoRa Initializing OK! [2021-04-27 22:33:23.031] Dumpreg AFTER reset: [2021-04-27 22:33:23.031] 0x0: 0xCB [2021-04-27 22:33:23.031] 0x1: 0x86 [2021-04-27 22:33:23.031] 0x2: 0x1A [2021-04-27 22:33:23.031] 0x3: 0xB [2021-04-27 22:33:23.031] 0x4: 0x0 [2021-04-27 22:33:23.031] 0x5: 0x52 [2021-04-27 22:33:23.031] 0x6: 0x6C [2021-04-27 22:33:23.031] 0x7: 0x40 [2021-04-27 22:33:23.031] 0x8: 0x0 [2021-04-27 22:33:23.031] 0x9: 0x8F [2021-04-27 22:33:23.031] 0xA: 0x9 [2021-04-27 22:33:23.031] 0xB: 0x2B [2021-04-27 22:33:23.031] 0xC: 0x23 [2021-04-27 22:33:23.031] 0xD: 0x1 [2021-04-27 22:33:23.031] 0xE: 0x0 [2021-04-27 22:33:23.031] 0xF: 0x0 [2021-04-27 22:33:23.031] 0x10: 0x0 [2021-04-27 22:33:23.031] 0x11: 0x0 [2021-04-27 22:33:23.031] 0x12: 0x0 [2021-04-27 22:33:23.031] 0x13: 0x0 [2021-04-27 22:33:23.031] 0x14: 0x0 [2021-04-27 22:33:23.031] 0x15: 0x0 [2021-04-27 22:33:23.031] 0x16: 0x0 [2021-04-27 22:33:23.031] 0x17: 0x0 [2021-04-27 22:33:23.031] 0x18: 0x4 [2021-04-27 22:33:23.031] 0x19: 0x0 [2021-04-27 22:33:23.031] 0x1A: 0x0 [2021-04-27 22:33:23.031] 0x1B: 0x3F [2021-04-27 22:33:23.031] 0x1C: 0x0 [2021-04-27 22:33:23.031] 0x1D: 0x72 [2021-04-27 22:33:23.068] 0x1E: 0x74 [2021-04-27 22:33:23.068] 0x1F: 0x64 [2021-04-27 22:33:23.068] 0x20: 0x0 [2021-04-27 22:33:23.068] 0x21: 0x8 [2021-04-27 22:33:23.068] 0x22: 0x1 [2021-04-27 22:33:23.068] 0x23: 0xFF [2021-04-27 22:33:23.068] 0x24: 0x0 [2021-04-27 22:33:23.068] 0x25: 0x0 [2021-04-27 22:33:23.068] 0x26: 0x4 [2021-04-27 22:33:23.068] 0x27: 0x0 [2021-04-27 22:33:23.068] 0x28: 0x0 [2021-04-27 22:33:23.068] 0x29: 0x0 [2021-04-27 22:33:23.068] 0x2A: 0x0 [2021-04-27 22:33:23.068] 0x2B: 0x0 [2021-04-27 22:33:23.068] 0x2C: 0x9 [2021-04-27 22:33:23.068] 0x2D: 0x50 [2021-04-27 22:33:23.068] 0x2E: 0x14 [2021-04-27 22:33:23.068] 0x2F: 0x45 [2021-04-27 22:33:23.068] 0x30: 0x55 [2021-04-27 22:33:23.068] 0x31: 0xC3 [2021-04-27 22:33:23.068] 0x32: 0x5 [2021-04-27 22:33:23.068] 0x33: 0x27 [2021-04-27 22:33:23.068] 0x34: 0x1C [2021-04-27 22:33:23.068] 0x35: 0xA [2021-04-27 22:33:23.068] 0x36: 0x3 [2021-04-27 22:33:23.068] 0x37: 0xA [2021-04-27 22:33:23.068] 0x38: 0x42 [2021-04-27 22:33:23.068] 0x39: 0x32 [2021-04-27 22:33:23.068] 0x3A: 0x52 [2021-04-27 22:33:23.068] 0x3B: 0x1D [2021-04-27 22:33:23.068] 0x3C: 0x0 [2021-04-27 22:33:23.068] 0x3D: 0xAF [2021-04-27 22:33:23.068] 0x3E: 0x0 [2021-04-27 22:33:23.068] 0x3F: 0x0 [2021-04-27 22:33:23.068] 0x40: 0x0 [2021-04-27 22:33:23.068] 0x41: 0x0 [2021-04-27 22:33:23.068] 0x42: 0x12 [2021-04-27 22:33:23.068] 0x43: 0x24 [2021-04-27 22:33:23.068] 0x44: 0x2D [2021-04-27 22:33:23.110] 0x45: 0x0 [2021-04-27 22:33:23.110] 0x46: 0x3 [2021-04-27 22:33:23.110] 0x47: 0x0 [2021-04-27 22:33:23.110] 0x48: 0x4 [2021-04-27 22:33:23.110] 0x49: 0x23 [2021-04-27 22:33:23.110] 0x4A: 0x0 [2021-04-27 22:33:23.110] 0x4B: 0x9 [2021-04-27 22:33:23.110] 0x4C: 0x5 [2021-04-27 22:33:23.110] 0x4D: 0x84 [2021-04-27 22:33:23.110] 0x4E: 0x32 [2021-04-27 22:33:23.110] 0x4F: 0x2B [2021-04-27 22:33:23.110] 0x50: 0x14 [2021-04-27 22:33:23.110] 0x51: 0x0 [2021-04-27 22:33:23.110] 0x52: 0x0 [2021-04-27 22:33:23.110] 0x53: 0x10 [2021-04-27 22:33:23.110] 0x54: 0x0 [2021-04-27 22:33:23.110] 0x55: 0x0 [2021-04-27 22:33:23.110] 0x56: 0x0 [2021-04-27 22:33:23.110] 0x57: 0xF [2021-04-27 22:33:23.110] 0x58: 0xE0 [2021-04-27 22:33:23.110] 0x59: 0x0 [2021-04-27 22:33:23.110] 0x5A: 0xC [2021-04-27 22:33:23.110] 0x5B: 0xEF [2021-04-27 22:33:23.110] 0x5C: 0x6 [2021-04-27 22:33:23.110] 0x5D: 0x0 [2021-04-27 22:33:23.110] 0x5E: 0x5C [2021-04-27 22:33:23.110] 0x5F: 0x78 [2021-04-27 22:33:23.110] 0x60: 0x0 [2021-04-27 22:33:23.110] 0x61: 0x1C [2021-04-27 22:33:23.110] 0x62: 0xE [2021-04-27 22:33:23.110] 0x63: 0x5B [2021-04-27 22:33:23.110] 0x64: 0xCC [2021-04-27 22:33:23.110] 0x65: 0x0 [2021-04-27 22:33:23.110] 0x66: 0x1 [2021-04-27 22:33:23.110] 0x67: 0x50 [2021-04-27 22:33:23.110] 0x68: 0x0 [2021-04-27 22:33:23.110] 0x69: 0x0 [2021-04-27 22:33:23.151] 0x6A: 0x0 [2021-04-27 22:33:23.152] 0x6B: 0x0 [2021-04-27 22:33:23.152] 0x6C: 0x0 [2021-04-27 22:33:23.152] 0x6D: 0x0 [2021-04-27 22:33:23.152] 0x6E: 0x0 [2021-04-27 22:33:23.152] 0x6F: 0xB [2021-04-27 22:33:23.152] 0x70: 0xD0 [2021-04-27 22:33:23.152] 0x71: 0x0 [2021-04-27 22:33:23.152] 0x72: 0x13 [2021-04-27 22:33:23.152] 0x73: 0x0 [2021-04-27 22:33:23.152] 0x74: 0x0 [2021-04-27 22:33:23.152] 0x75: 0x0 [2021-04-27 22:33:23.152] 0x76: 0x0 [2021-04-27 22:33:23.152] 0x77: 0x0 [2021-04-27 22:33:23.152] 0x78: 0x0 [2021-04-27 22:33:23.152] 0x79: 0x0 [2021-04-27 22:33:23.152] 0x7A: 0x0 [2021-04-27 22:33:23.152] 0x7B: 0x0 [2021-04-27 22:33:23.152] 0x7C: 0x0 [2021-04-27 22:33:23.152] 0x7D: 0x0 [2021-04-27 22:33:23.152] 0x7E: 0x0 [2021-04-27 22:33:23.152] 0x7F: 0x0 [2021-04-27 22:33:23.152] -END LORA DumpReg- [2021-04-27 22:33:24.980] [2021-04-27 22:33:24.980] 0000; Time ;00:03:16; To: 200 From: 203 ID: 192 Size: 9 [0][10][100][22][33][44]

romigr commented 3 years ago

Thanks! I will try that. Regards, Richard Alan (Al) Romig 2619 Forest Oaks Drive College Station, TX 77845 979-485-1148 home 713-201-4413 cell

On Wed, Mar 3, 2021 at 10:05 PM IoTThinks.com @.***> wrote:

I have no problem receiving packets for months. You can try to use the receiver at https://github.com/sandeepmistry/arduino-LoRa/blob/master/examples/LoRaReceiverCallback/LoRaReceiverCallback.ino

You need to set the pins, too. https://github.com/sandeepmistry/arduino-LoRa/blob/master/API.md#set-pins

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-LoRa/issues/447#issuecomment-790273291, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE45OM5MHPG6CCQS3B5H5NDTB4BIXANCNFSM4YSL3FWA .

robas commented 3 years ago

Hey @romigr any updates about this issue? Apparently, I have been facing the same problem and trying to understand what is going on.

Thank you.

romigr commented 3 years ago

Hi Rodrigo, No, I don't have any more news. I have been working on other projects, but I will get back to LoRa before long..

Richard Alan (Al) Romig 2619 Forest Oaks Drive College Station, TX 77845 979-485-1148 home 713-201-4413 cell

On Thu, Jun 17, 2021 at 9:41 PM Rodrigo Lopes @.***> wrote:

Hey @romigr https://github.com/romigr any updates about this issue? Apparently, I have been facing the same problem and trying to understand what is going on.

Thank you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sandeepmistry/arduino-LoRa/issues/447#issuecomment-863711830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE45OM2Y7YKHZC675EINVXTTTKW47ANCNFSM4YSL3FWA .

bharadwajtke commented 3 years ago

Hi, I am facing the same problem, if anybody has any brekthrough on this plz let me know. For time being i am polling for data reception of lora, after putting delay lets say 3ms it reduced hanging considerably, if it stps receiving i am sending data like heart beat again it resumes...its little peculiar for me...plz let me know any brwakthrough by any one or any other work around

IoTThinks commented 3 years ago

Can try to use callback listener instead of parsePacket.

IoTThinks commented 3 years ago

May be related and solved issue: https://github.com/sandeepmistry/arduino-LoRa/issues/363

doidgy commented 2 years ago

I am afraid I have exactly the same issue, I followed the #363 issue but that was more for transmitter problems, my issue is exactly as the OP

kulaksazov commented 2 years ago

Hi, I had the same problem with my heltec esp 32 LoRa - at any moment it just stopped taking! There is no such thing with a transmitter. The problem is solved very easily! In the loop section, or where the LoRa read loop is, after the end of the loop just put:

// put the radio into receive mode LoRa.receive();

just to "remind" each time the device that you need to keep taking! It hasn't stopped yet! At least for me the problem is solved :) Heltec library version: 1.1.0

Inrebusillis commented 2 years ago

Same issue: Heltec Lora OLED v 2 ( two pairs) with Heltec library/ arduino library, lora libraries.... tryed onreceive method, different library, rewrite code, add Lora receive in the loop-.... still randomly hanging.... anyone has a clue of what is happening?

Inrebusillis commented 2 years ago

Same issue: Heltec Lora OLED v 2 ( two pairs) with Heltec library/ arduino library, lora libraries.... tryed onreceive method, different library, rewrite code, add Lora receive in the loop-.... still randomly hanging.... anyone has a clue of what is happening?

Do not ask me why: I put a line Serial.println(currentTime); at the beginning and at the end of the loop and everything is now working..... A bug between Serial and Lora communication? ( no, I did not test setting the Serial Enable to "false", I was using the Heltec library. I was just happy that finally works.

//Serial.begin(115200); Heltec.begin(true /DisplayEnable Enable/, true /Heltec.Heltec.Heltec.LoRa Disable/, true /Serial Enable/, true /PABOOST Enable/, BAND /long BAND/);

fizga commented 1 year ago

hello to all, I am facing the same problem, the arduino MEGA freezes randomly, I use an RFM95 module. after several tests the problem occurs when I use the LoRa library. I tried the solutions above but the problem persists. has anyone found a solution?