arduino-LoRa
arduino-LoRa copied to clipboard
endpacket() never returns due to SX127x crashed, possible workaround
There is a known problem with SX127x where it hangs and never reports TX finished. As reported by several users - https://forum.arduino.cc/index.php?topic=574911.0 when that happens, also a normal reset procedure cannot recover the SX127x logic. That means, the application will be hanging until power toggle. The root cause could be SPI problems due to a bad pcb layout (that's what Semtech seems to claim), but nobody knows for sure. There is a workaround (reset procedure consisting of several steps) which can be found here: https://github.com/Lora-net/LoRaMac-node/blob/develop/src/radio/sx1276/sx1276.c after the line "// BEGIN WORKAROUND".
I am using ATMega328p with SX1276 at 3.3 Volt in a battery powered sensor application. I can send several thousand messages during several weeks runtime, and suddenly problem occurs. It would be great to update this very good library with the workaround reset procedure so that whenever TXdone times out, the Lora logic could be reset successfully and automatically by the library.
Try to increase the SPI speed to 8Mhz or above?
BTW, is your chip SX1278 or SX1276?
You mention ra02 433Mhz, so it is sx1278?

Increase SPI speed? I thought I would try to decrease to make it more robust... As said I am using Atmega328P with SX1276 (RFM95 Module)
@Markusenz Have you tried to put in the fix?
@Markusenz seems I'm running into the same issue - after some time my TTGO Lora32 is unable to send or receive LoRa traffic (even though it thinks it sends the data successfully). Were you able to resolve it?
@Markusenz seems I'm running into the same issue - after some time my TTGO Lora32 is unable to send or receive LoRa traffic (even though it thinks it sends the data successfully). Were you able to resolve it?
I tried to implement the fix, however I also made additional improvements in my code, and it never happened so far. I am running about 30 nodes since October without any problems. But note that if the issue arises, the library call for sending the msg will hang until the device is externally reset (the TX done interrupt from the RFM95 module is not firing so the code hangs at that stage within the library code). If in your case the device returns as if the msg was sent out, there is most likely a different problem in your case.
Possible solution is add delayMicroseconds(1); in function singleTransfer befor digitalWrite(_ss, HIGH);
https://forum.pjrc.com/threads/41878-Probable-race-condition-in-Radiohead-library https://forum.pjrc.com/attachment.php?attachmentid=10948&d=1499109224
May be related and solved issue: https://github.com/sandeepmistry/arduino-LoRa/issues/363