hallard / LoRasPI

Raspberry PI Lora Gateway/Node for HopeRF RFM95 RFM96 RFM98 Modules
129 stars 38 forks source link

problem #2

Closed raspberry007 closed 7 years ago

raspberry007 commented 8 years ago

Hi,

Did you test v1.2 please? I have two boards (one with rfm95w and another one with rfm68hcw) and both of them have problems. Transceivers are not detected by spi_scan., On both I connected D0 with 1N4148 and have R3 in place. Anything in particular I should check?

My RPi3 is detecting other boards with rfm95w with no problem.

Thanks Alex

hallard commented 8 years ago

@alex1sh Since V1.0 and V1.1 are working fine and I didn't make so much change between then it's very strange. I have boards but not assembled/tested them yet, I need to check.

You're wiring is correct, did you enabled SPI kernel module on RPI? Does the reset line of the module (GPIO22) is in the correct state ? should be low for RFM69HCW and high for RFM95 ?

hallard commented 8 years ago

I took some time to assemble one during lunch time, you're right there is one error on V1.2, a small missing trace on CS signal prevent board from working, I updated to V1.2a and provided a fix for V1.2, you can see ReadMe for how to fix this error.

I really apologize for this!

raspberry007 commented 8 years ago

@hallard

Thanks Charles. I have corrected my board 1.2 version (the clean way) and tested it with the multimeter and now I can see that CE rfm95w pin is now connected to GPIO07 (pin #26) on P1. However, I am still struggling to make it work:

pi@m:~/RadioHead/examples/raspi/spi_scan $ sudo ./spi_scan Checking register(0x42) with CS=GPIO06 => Nothing! Checking register(0x10) with CS=GPIO06 => Nothing! Checking register(0x42) with CS=GPIO08 => Nothing! Checking register(0x10) with CS=GPIO08 => Nothing! Checking register(0x42) with CS=GPIO07 => Nothing! Checking register(0x10) with CS=GPIO07 => Nothing! Checking register(0x42) with CS=GPIO26 => Nothing! Checking register(0x10) with CS=GPIO26 => Nothing! pi@m:~/RadioHead/examples/raspi/spi_scan $ sudo ./spi_scan Checking register(0x42) with CS=GPIO06 => Unknown (V=0x40) Checking register(0x10) with CS=GPIO06 => Unknown (V=0x40) Checking register(0x42) with CS=GPIO08 => Unknown (V=0x40) Checking register(0x10) with CS=GPIO08 => Unknown (V=0x40) Checking register(0x42) with CS=GPIO07 => Unknown (V=0x40) Checking register(0x10) with CS=GPIO07 => Unknown (V=0x40) Checking register(0x42) with CS=GPIO26 => Unknown (V=0x40) Checking register(0x10) with CS=GPIO26 => Unknown (V=0x40)

I have only D0 in place so maybe this is a problem?

hallard commented 8 years ago

Alex, I can't test it right now, but spi_scan from my radioHead library may be different than the one from LMIC version I tested LoRasPI with. Would you please check with this LMIC RPI version just to be sure? https://github.com/hallard/arduino-lmic/tree/rpi spi_scan is under examples/raspi/ https://github.com/hallard/arduino-lmic/tree/rpi/examples/raspi/spi_scan

raspberry007 commented 8 years ago

No, the other spi_scan is giving me the same result. No luck. The Single Channel LoRaWAN Gateway is not working either. I can see the LED flashing a few times and that's it when I execute the command:

pi@m:~/single_chan_pkt_fwd $ sudo ./single* server: .address = router.eu.staging.thethings.network; .port = 1700; .enable = 1 server: .address = router.eu.thethings.network; .port = 1700; .enable = 0 Gateway Configuration SC Gateway (contact@whatever.com) Dragino Single Channel Gateway on RPI Latitude=0.00000000 Longitude=0.00000000 Altitude=10 Trying to detect module with NSS=10 DIO0=6 Reset=3 Led1=4 Transceiver version 0x00 Unrecognized transceiver: Connection timed out

I'll try to solder other diodes and see if it makes any difference.

hallard commented 8 years ago

Oh sorry, diode will not change anything they are used for IRQ once device is running. Are you using latest raspian on your RPI?

hallard commented 8 years ago

May be checking SPI line connection like you done for CS line, I don't see why it does not works? IT works on mine

raspberry007 commented 8 years ago

OK, I must admit that I forgot to stop domoticz service, which was trying to use SPI to detect nrf24l01+. This has caused the problem.

Trying now to detect the module, but it does not work 100%

pi@m:~/arduino-lmic/examples/raspi/spi_scan $ sudo ./spi Checking register(0x42) with CS=GPIO24 => Nothing! Checking register(0x10) with CS=GPIO24 => Nothing! Checking register(0x42) with CS=GPIO08 => Nothing! Checking register(0x10) with CS=GPIO08 => Nothing! Checking register(0x42) with CS=GPIO07 => Nothing! Checking register(0x10) with CS=GPIO07 => Nothing! Checking register(0x42) with CS=GPIO26 => Nothing! Checking register(0x10) with CS=GPIO26 => Nothing! pi@m:~/arduino-lmic/examples/raspi/spi_scan $ sudo ./spi Checking register(0x42) with CS=GPIO24 => Nothing! Checking register(0x10) with CS=GPIO24 => Nothing! Checking register(0x42) with CS=GPIO08 => SX1276 RF95/96 (V=0x12) Checking register(0x10) with CS=GPIO08 => Nothing! Checking register(0x42) with CS=GPIO07 => Nothing! Checking register(0x10) with CS=GPIO07 => Nothing! Checking register(0x42) with CS=GPIO26 => Nothing! Checking register(0x10) with CS=GPIO26 => Nothing!

Anyway, the Single LoraWan Gateway is working and that's the key. Thanks for your help.

raspberry007 commented 8 years ago

But the way the LED only comes on after I do spi_scan. Is it supposed to be like that? (The other one comes on when transmitting/receiving, right?)

raspberry007 commented 8 years ago

Thank you for your help and sharing your knowledge - very much appreciate it.

Unfortunately, the board does not work in my case.. I tried to install a new Jessie (Sep 2016) and still I have the following:

Message from syslogd@rpi3 at Oct 13 09:33:10 ... kernel:[32568.765124] Disabling IRQ #79

I cannot receive messages. I tried several boards with rfm69hcw and rfm95w with the same result. Single Channel GW does not seem to work as I cannot connect a node (Sodaq ONE) to it. It does update the GW status here though: https://www.thethingsnetwork.org/api/v0/gateways/B827EBFFFF0247FA/

but no reception from nodes. Perhaps I am doing something very silly...

hallard commented 8 years ago

@alex1sh I'm using the 3 version of Loraspi (V1.0, V1.1 and V1.2) on 3 different RPI without any problem.

What software are you running with LoRasPI board and what the log are saying ?

PS : I've updated spi_scan to avoid detection problem at 1st launch, now it set up all CS possible line to High before doing a scan

raspberry007 commented 8 years ago

Clearly, I am doing something wrong. The problem is that I just cannot link the node and the GW. Running your modified GW gives me this:

pi@rpi3:~/old/single_chan_pkt_fwd $ sudo ./single* server: .address = router.eu.staging.thethings.network; .port = 1700; .enable = 0 server: .address = router.eu.thethings.network; .port = 1700; .enable = 1 Gateway Configuration SC Gateway (contact@whatever.com) Single Channel Gateway on RPI Latitude=51.47623062 Longitude=-0.12268900 Altitude=7 Trying to detect module with NSS=10 DIO0=6 Reset=3 Led1=4 SX1276 detected, starting. Gateway ID: b8:27:eb:ff:ff:02:47:fa

Listening at SF7 on 868.100000 Mhz.

stat update: 2016-10-14 00:47:52 GMT no packet received yet stat update: 2016-10-14 00:48:22 GMT no packet received yet stat update: 2016-10-14 00:48:52 GMT no packet received yet stat update: 2016-10-14 00:49:22 GMT no packet received yet stat update: 2016-10-14 00:49:52 GMT no packet received yet stat update: 2016-10-14 00:50:22 GMT no packet received yet

Meantime, when I tried to OTAA the node (Sodaq ONE) I get: Initializing LoRa... [initOTA] [init] [sleep] [wakeUp] [resetDevice] [expectString] expecting RN.(RN2483 1.0.1 Dec 15 2015 09:38:09) found a match! The device type is RN2483 [setMacParam] deveui = [array][expectString] expecting ok.(ok) found a match! [setMacParam] appeui = [array][expectString] expecting ok.(ok) found a match! [setMacParam] appkey = [array][expectString] expecting ok.(ok) found a match! [setMacParam] adr = on [expectString] expecting ok.(ok) found a match! [joinNetwork] [expectString] expecting ok.(ok) found a match! [expectString] expecting accepted.......(denied)LoRa init failed! [sleep] \ Boot-up completed successfully!

The node has not registered in the network and the gateway is not even showing that packets are received. Are there any chance to test if the gateway is able to receive packets from a node? Once again many thanks for your help

raspberry007 commented 8 years ago

To eliminate the issue of SX1276, trying otaa on the RPi3:

pi@rpi3:~/arduino-lmic/examples/raspi/ttn-otaa $ sudo ./ttn-otaa ttn-otaa Starting RFM95 device configuration CS=GPIO8 RST=GPIO22 LED=GPIO23 DIO0=Unused DIO1=Unused DIO2=Unused DevEUI : B8*** AppEUI : 70B3D5* AppKey : F8***** RXMODE_RSSI 10:38:06: 542: engineUpdate, opmode=0x8 Packet queued 10:38:06: EV_JOINING 547: engineUpdate, opmode=0xc 274197: engineUpdate, opmode=0xc 274260: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0 590778: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0 656254: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0 666669: engineUpdate, opmode=0xc 4451325: engineUpdate, opmode=0xc 4451382: TXMODE, freq=868100000, len=23, SF=7, BW=125, CR=4/5, IH=0 4767899: RXMODE_SINGLE, freq=868100000, SF=7, BW=125, CR=4/5, IH=0 4833375: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0 4843795: engineUpdate, opmode=0xc 9082304: engineUpdate, opmode=0xc 9082362: TXMODE, freq=868300000, len=23, SF=8, BW=125, CR=4/5, IH=0 9402151: RXMODE_SINGLE, freq=868300000, SF=8, BW=125, CR=4/5, IH=0 9467531: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0 9477947: engineUpdate, opmode=0xc 17246128: engineUpdate, opmode=0xc 17246186: TXMODE, freq=868500000, len=23, SF=8, BW=125, CR=4/5, IH=0 17565975: RXMODE_SINGLE, freq=868500000, SF=8, BW=125, CR=4/5, IH=0 17631355: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0 17641771: engineUpdate, opmode=0xc 24686286: engineUpdate, opmode=0xc 24686346: TXMODE, freq=868100000, len=23, SF=9, BW=125, CR=4/5, IH=0 25012136: RXMODE_SINGLE, freq=868100000, SF=9, BW=125, CR=4/5, IH=0 25077324: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0 25087743: engineUpdate, opmode=0xc 38116791: engineUpdate, opmode=0xc 38116846: TXMODE, freq=868300000, len=23, SF=9, BW=125, CR=4/5, IH=0 38442641: RXMODE_SINGLE, freq=868300000, SF=9, BW=125, CR=4/5, IH=0 38507830: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0 38518252: engineUpdate, opmode=0xc

and it never JOINED. The keys are correct, I had them checked many times (DevEUI and AppEUI had to be in endian format and AppKey is in the normal format). No wonder that ttnctl is telling me:

ttnctl.exe devices info B827EB5712AF0400 Dynamic device:

AppEUI: 70B3D57ED0001135 {0x70, 0xB3, 0xD5, 0x7E, 0x--, 0x--, 0x--, 0x--}

DevEUI: B827EB5712AF0400 {0xB8, 0x27, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--}

AppKey: F87BA0E8972E044CA51235C8E2757008 {0xF8, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--, 0x--}

Not yet activated

raspberry007 commented 8 years ago

By the way thanks for fixing spi_scan - it works now!

hallard commented 8 years ago

@alex1sh you're using a full lorawan device (RN2483) with a degraded version (single channel gateway) which is not full lorawan compliant. I'm not a specialist but I think this is why it's not working May be you'll have better answer on TTN forum for this issue.

raspberry007 commented 8 years ago

Thanks - you are right. This is a complex issue and I am waiting for an official TTN GW. Unfortunately, TTN Forum is not very active - I did not get much reply over there.

I do not understand why ttn-otaa fails on my RPi. RPi is sending the request directly to TTN server or is looking for a GW?

hallard commented 8 years ago

humm, I always find TTN very active, where is your topic ?

./ttn-otaa on RPI is looking for a gateway it's a client node

raspberry007 commented 8 years ago

https://www.thethingsnetwork.org/forum/t/sodaq-one-cannot-register-on-ttn/3734

OK, this explains why I cannot register with TTN running ./ottn-otaa. Can I run both single channel packet forwarder and ./ttn-otaa on the same RPI?

hallard commented 7 years ago

@alex1sh you mean running both with 2 differents boards? If so, technically, yes but if you use two process you must ensure they do not talk SPI on the same time with semaphore or so. This need rewrite lot of code on both process, I can guarantee more pain than buying another RPI or a WeMos with RFM95 for ttn otaa ;-)