mcci-catena / arduino-lmic

LoraWAN-MAC-in-C library, adapted to run under the Arduino environment
https://forum.mcci.io/c/device-software/arduino-lmic/
MIT License
648 stars 212 forks source link

Assertion failure at radio.c line 923 #806

Open CHMSFlix opened 3 years ago

CHMSFlix commented 3 years ago

Hi,

I getting this error while I run the code in Arduino UNO. using ttn_abp.ino

Serial Monitor. Error: Starting 7143: EV_TXSTART Packet queued FAILURE C:\Users\issel\Documents\Arduino\libraries\arduino-lmic-master\src\lmic\radio.c:923

lmic_pins configuration is:

const lmic_pinmap lmic_pins = { .nss = 10, // chip select on feather (rf95module) CS .rxtx = LMIC_UNUSED_PIN, .rst = 9, // reset pin .dio = {2, 6, 7}, }; I checked the connection. It's perfectly connected. let me know what will be the problem.

Please help to resolve this.

Environment:-

terrillmoore commented 3 years ago

Sorry you're having problems. The failure points us to line 926 of radio.c. There we see:

https://github.com/mcci-catena/arduino-lmic/blob/26326e4fc30fd6ee95cf8d5f78e16f34e957d38b/src/lmic/radio.c#L922-L923

This means.

  1. The LMIC sent a SPI command to put the radio into LoRa mode.
  2. The LMIC read back the mode register, and the radio is not in LoRa mode.

This is not anything software can recover from, as it indicates unspecified behavior in the SX1276. It will be necessary to investigate the hardware connections more carefully.

I do not know your background, and you haven't posted photos of your setup. My recommendations therefore may seem either too simple or too complicated. Apologies in advance.

My guess is grounding or power supply issues. Check your grounds, make sure you have adequate decoupling, make sure you have short wires. Use an oscilliscope to look at the AC noise on Vdd and GND while operating the radio. Modify the code at line 923 so that it loops for ever doing opmodeLoRa() followed by readReg(RegOpMode) -- nothign else in a while(1) loop. Then you can use a scope to look at signal quality on the SPI clk and data lines as well as Vdd and gnd.

Good luck!

CHMSFlix commented 3 years ago

Hi terrillmoore,

Now, I am not getting the error. But TX_COMPLETE event has not occurred. Now, my console looks like this:

Starting Configure CFG_eu868 7154: EV_TXSTART Packet queued

After this, it goes to the loop()function. I am not getting any errors on radio.c file. What will be the issue here?

mrx23dot commented 2 years ago

I wouldn't put assertion onto external sources, noise on SPI can bring down the whole system (e.g. pump controller).

All it should do is to start a comms reinit.

Field experience: once in a while a MEMS device got into an undocumented state, which should have never happened, but after a reinit it works for a long time again.