New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
While loop, sometimes takes long or never ends #378
Comments
Interesting. What is the packet length and SF/BW? |
Packets are 30 to 70 bytes. Normally, It takes between 150 ms to 500 ms to ge the IRQ_TX_DONE_MASK. SF is 8, and BW is 250E3. |
"then the code never puts back the LoRA into receive mode. Consequently, packets do not arrive anymore." For me, after sending, I normally set to receive mode manually. |
I noticed similar issue as described by @JRAlvarez2017.
As a workaround I've started to use "endPacket" method asynchronously:
Next I've marked "isTransmitting()" method as "public". Now in my code I can send a message and wait defined time for end of the transmission:
Please consider to add timeout for "LoRaClass::endPacket" method if it is executed synchronously. |
@PrzemyslawMotyl , @JRAlvarez2017
|
I don't know maybe this is hardware issue. |
Hi dears, I have same problem as you mentioned. I have good communication But after a while the receiver can't receive anything. |
Hi, What LoRa settings do you have?
Here you can increase this timeout. Try to use 10 seconds:
I'm using strong 433 antennas and I had to decrease TX power also. Without this also I had problems. Regards, |
hi @PrzemyslawMotyl . I did that but it stop to receive after 15-16 hours.
|
In LoRa.h just put "isTransmitting" in "public" section:
|
This Issue still persists.
This is my output for the read registers:
Value 0x15 in REG_IRQ_FLAGS seems to be the reset for the IRQs. All of them say "Writing a 1 clears the IRQ." EDIT: |
Update: My 2nd, identical transmitter doesn't do this. If i run the library with debug output on Arduino 1 (working one)
On the Arduino 2 (not working) it says this:
While it not only resets OP-Mode to 0x09, it also seems to have a different REG_IRQ_FLAGS register with 0x15 instead of like Arduino 1 has (0x8). It changed from LongRangeMode = 1, Mode = 1 (Standby) to LowFrequencyModeOn = 1, Mode = 1 (Standby). EDIT: I just realised i used the readRegister() function for outputting the #define variable. |
I noticed that sometimes , the while loop in the endPacket() function takes too long. I think there should be a time-out inside the loop to break. Here I wrote an example of just an idea of how to dodge the problem.
int LoRaClass::endPacket(bool async)
{
if ((async) && (_onTxDone))
writeRegister(REG_DIO_MAPPING_1, 0x40); // DIO0 => TXDONE
// put in TX mode
writeRegister(REG_OP_MODE, MODE_LONG_RANGE_MODE | MODE_TX);
if (!async) {
// wait for TX done
delay(10);
unsigned int i = 0;
while ((readRegister(REG_IRQ_FLAGS) & IRQ_TX_DONE_MASK) == 0)
{
delay(5);
if (i++ > 1000)
break;
}
// clear IRQ's
writeRegister(REG_IRQ_FLAGS, IRQ_TX_DONE_MASK);
}
return 1;
}
The text was updated successfully, but these errors were encountered: