wklenk / lmic-rpi-lora-gps-hat

Hardware Abstraction Layer (HAL) for IBM's LMIC 1.6 communication stack targeted to RPi and Dragino LoRA/GPS HAT.
Other
46 stars 48 forks source link

No Join Received #11

Open skeff839 opened 6 years ago

skeff839 commented 6 years ago

Hello, i can't receive a JOIN ACCEPT. In the Live LoRa Frame Logs at the backend i can see the incoming Join-Requests and the outgoing Join-Accepts. Therefore the EUIs and APPKEY must be right. But my RPi does not receive those Join Accepts. I use a RPi 3 and the LoRa Hat v1.4.

The log from the join example 000000000 HAL: Initializing ... 000000003 HAL: Detected SX1276 radio module. 000000003 HAL: Set radio RST pin to 0x00 000000003 HAL: Wait until 000000004 ms 000000007 HAL: Set radio RST pin to 0x02 000000007 HAL: Wait until 000000012 ms 000000013 HAL: Receiving ... 000000023 Debug: Initializing 000000023 Debug: JOINING 000007006 Debug: EV_TXSTART 000007006 HAL: Sending ... 000012068 HAL: Receiving ... 000012068 HAL: Wait until 000012069 ms 000013115 HAL: Receiving ... 000013115 HAL: Wait until 000013117 ms 000075673 Debug: EV_TXSTART 000075673 HAL: Sending ... 000080735 HAL: Receiving ... 000080736 HAL: Wait until 000080737 ms 000081783 HAL: Receiving ... 000081783 HAL: Wait until 000081785 ms 000149214 Debug: EV_TXSTART 000149215 HAL: Sending ... 000154330 HAL: Receiving ... 000154330 HAL: Wait until 000154331 ms 000155376 HAL: Receiving ... 000155376 HAL: Wait until 000155377 ms 000277800 Debug: EV_TXSTART 000277801 HAL: Sending ... 000282916 HAL: Receiving ... 000282916 HAL: Wait until 000282917 ms 000283962 HAL: Receiving ... 000283962 HAL: Wait until 000283963 ms 000410337 Debug: EV_TXSTART 000410338 HAL: Sending ... 000415549 HAL: Receiving ... 000415549 HAL: Wait until 000415550 ms 000416592 HAL: Receiving ... 000416592 HAL: Wait until 000416593 ms

Thank you.

skeff839 commented 6 years ago

I receive the Join-Accept through a Kerlink Wirnet Station at a SF=7, a SNR of -1,2 and at a frequency of 868,3 MHz. Therefore the connection is quite good. My backend is the https://www.loraserver.io/ and works well with other Nodes.

xiphias256 commented 6 years ago

Same issue here. I'm using a RPi Zero W with a Lora sx1276 connected via a breadboard. I have the same output as @skeff839 I never get a joined message. My gateway is the original ttn gateway. On the TTN application page, I can see that the device is connecting.

wklenk commented 6 years ago

You wrote you do use a LoRa Hat 1.4. In Version 1.4, the output lines DIO0, DIO1 and DIO2 should already be correctly wired to the Raspberry Pi GPIO pins. But please double check that ...

DIO0 is connected to physical pin #7 aka WiringPi pin 7 aka BCM pin 4. DIO1 is connected to physical pin #16 aka WiringPi pin 4 aka BCM pin 23. DIO2 is connected to physical pin #18 aka WiringPi pin 5 aka BCM pin 24.

If DIO1 ist not wired up correctly, you will never get the trigger that some data was received by the LoRa chip. I you want to investigate further, you can put a logic analyzer to the DIO1 line. If it changes approximately 5 seconds after the "join" request ist sent, then either the response comes a little to soon or late, or you have a hardware issue, as the change of the DIO1 line is not recognized by the LMIC software stack.

xiphias256 commented 6 years ago

I 'm not using a LoRa Hat, but I'm wiring it up the same way as you have configured it in the hal.c source code.

img_20180824_212333

I have double checked that all connections are correct. But today I'm not even able to get the message through to the gateway :-/ It seems the whole hw setup is unreliable. Do you know the output voltages on the spi interface on a rpi zero? The LoRa chip expects 3.3v. I'm afraid the rpi is giving out 5v

xiphias256 commented 6 years ago

Update! I climbed up to my attic and collected my old single channel ttn gateway, which is a rpi 3 mod B with a dragino LoRa Hat ver 1.4. Ran your software on it, and it worked flawless on the first try!! :-D I guess you are right, saying it has to do with timing. Do you have any pointers to where in your code this DIO1 timing stuff is located? I will see if I can get hold of someone with a logic analyser, that can help me troubleshoot the rpi zero.

brentru commented 5 years ago

I'm having the same issue as @xiphias256 with the wiring described in hal.c matching my pi wiring using a stock TTN gateway.

xiphias256 commented 5 years ago

Tried with another Lora chip (5V safe) and rpi zero again. And this time it works fine.

antonmeyer commented 5 years ago

I have the same issue, no join. I have checked the DIO1 at the RFM95 and the Raspi GPIO and saw a short impulse of 0.9 ms from low to high (and back), short after the first receive 000000000 HAL: Initializing ... 000000007 HAL: Detected SX1276 radio module. 000000009 HAL: Set radio RST pin to 0x00 000000010 HAL: Wait until 000000011 ms 000000012 HAL: Set radio RST pin to 0x02 000000015 HAL: Wait until 000000020 ms 000000021 HAL: Receiving ... 000000039 Debug: Initializing 000000039 Debug: JOINING 000006366 Debug: EV_TXSTART 000006367 HAL: Sending ... 000011429 HAL: Receiving ... 000011429 HAL: Wait until 000011430 ms 000012476 HAL: Receiving ... 000012476 HAL: Wait until 000012478 ms

I have tried to debug it on the gpio level at least once gpio wfi 4 falling came back with the "HAL: Receiving ..." but not realy reproduceable. Hm, strange short before sending I see a very short impulse from the blue LED on the HAT labled LORA-RX

Have checked the connection DIO1 to pi-GPIO4, 0.5 Ohm. So might be the impulse is to short, software too slow, signal level too low? Checking voltage of power supply 5V -> 5.04V, 3.3V -> 3.28V, perfect.

git1k2 commented 5 years ago

climbed up to my attic and collected my old single channel ttn gateway

This triggered me. There is/was something changed from the RPI2 to RPI3 regarding SPI. I had the same problems as described above.

Can you try switching between RPI2 and RPI3, or if you are using the RPI3 change the setting as below?

/boot/config.txt

core_freq=250
core_freq_min=250
Hacklog24 commented 5 years ago

@wklenk @skeff839 Hi, I use the same hardware, can you help me? Did you change anything? After setting the keys and executing, it goes wrong after the following lines. Thanks a lot for your help.

000000000 HAL: Initializing ... 000000014 HAL: Detected unknown radio module: 0x26 000000014 HAL: Set radio RST pin to 0x00 000000014 HAL: Wait until 000000004 ms 000000017 HAL: Set radio RST pin to 0x02 000000017 HAL: Wait until 000000022 ms 000000022 HAL: Failed. Aborting

Stev1eG commented 5 years ago

Hi All,

Many thaks for the postings on here, and much thanks to Wolfgang for his work here.

Has anyone manged to resolve this (failure to join) with a good explanation/understanding?

I have a...

000000000 HAL: Initializing ... 000000010 HAL: Detected SX1276 radio module. 000000010 HAL: Set radio RST pin to 0x00 000000011 HAL: Wait until 000000011 ms 000000012 HAL: Set radio RST pin to 0x02 000000012 HAL: Wait until 000000017 ms 000000017 HAL: Receiving ... 000000024 Debug: Initializing 000000024 Debug: JOINING 000007389 Debug: EV_TXSTART 000007390 HAL: Sending ... 000012453 HAL: Receiving ... 000012453 HAL: Wait until 000012454 ms 000013500 HAL: Receiving ...

etc

I can see on the TTN console activation attempts...

{
  "time": "2019-06-03T11:37:14.130326968Z",
  "frequency": 868.1,
  "modulation": "LORA",
  "data_rate": "SF9BW125",
  "coding_rate": "4/5",
  "gateways": [
    {
      "gtw_id": "eui-0001fcc23d0f0241",
      "timestamp": 1590480364,
      "time": "2019-06-03T11:37:14.114038Z",
      "channel": 0,
      "rssi": -109,
      "snr": -5,
      "rf_chain": 1
    },
    {
      "gtw_id": "eui-0000024b0b030f7f",
      "timestamp": 3786914860,
      "time": "2019-06-03T11:37:14.111752Z",
      "channel": 0,
      "rssi": -115,
      "snr": 0.5,
      "rf_chain": 1
    },
    {
      "gtw_id": "eui-0000024b0b030e8c",
      "timestamp": 3814148260,
      "time": "2019-06-03T11:37:14.111806Z",
      "channel": 0,
      "rssi": -114,
      "snr": -13.8,
      "rf_chain": 1
    },
    {
      "gtw_id": "eui-0000024b0b030e34",
      "timestamp": 3805191348,
      "time": "2019-06-03T11:37:14.111779Z",
      "channel": 0,
      "rssi": -113,
      "snr": 4,
      "rf_chain": 1
    },
    {
      "gtw_id": "eui-0000024b0b030f87",
      "timestamp": 3788658572,
      "time": "2019-06-03T11:37:14.111749Z",
      "channel": 0,
      "rssi": -112,
      "snr": -3.2,
      "rf_chain": 1
    }
  ]
}

What I have noticed is that it will join eventually, but I am not sure of the reason and or/why it takes 3/4/5 more attempts. I can see how it cycles round frequency/channel and data_rate (and understand why looking at lmic.c): 868.1 Channel 0 SF7BW125 868.3 Channel 1 SF9BW125 868.5 Channel 2 SF9BW125

For each activation attempt, there are at least 3 GWs in evidence. Could it be to do with 'rssi'? I noticed that when a join was eventually successful, at least one of the GWs had an rssi < 100 with an snr of 8.5.

Once joined it seems to stay joined, and running 'periodic.out' seems to work OK.

My next activity will be to set up a gateway locally. I have a RAK831 concentrator board that I will set up this week and as it will be close to the end device, certainly rssi/snr values will be better.

RimantasSmitas commented 3 years ago

I had the same error, but as @Stev1eG mentioned this is a signal strength issue, I've tested the code on the same device in three locations one of them has a know good signal. The first two locations depending on weather conditions join was received in anywhere from 10min to 2 hours. I was able to see activation requests with similar signal strengths as @Stev1eG had. After those two I tested in a known good signal location and received a join practically instantly. So I guess the problem is that the Lora gateway has a better receiver than the pi hat and the Join doesn't make it back to the pi.