Node based on Raspberry?

Nice, thanks!

Another question :grin:, because I have some problems connecting and sending the first payloads to TTN. I am using the ttn-otaa.cpp example with a Dragino Lora Hat. I defined my PINS like in the example:

#define RF_CS_PIN  RPI_V2_GPIO_P1_22
#define RF_IRQ_PIN RPI_V2_GPIO_P1_07
#define RF_RST_PIN RPI_V2_GPIO_P1_11

The lmic_pins var is unchanged.

… but it’s stuck at EV_JOINING

pi@raspberrypi:~/arduino-lmic/examples/raspi/ttn-otaa $ sudo ./ttn-otaa 
ttn-otaa Starting
RFM95 device configuration
CS=GPIO25 RST=GPIO17 LED=Unused DIO0=Unused DIO1=Unused DIO2=Unused
DevEUI : ****
AppEUI : ****
AppKey : ****
14:36:37: Packet queued
14:36:37: EV_JOINING

Do I need to wire the PINs in any special way? I found some other examples where the DIO0, DIO1 and DIO2 pins needed a dedicated wiring to the GPIO pins. I think my AppEUI, DevEUI and AppKey is correct (lsb, msb, etc.), but could that be the reason?

Thanks in advance!

90% of my join failed was due to incorrect keys, ttn-otaa program should shows them exactly the same way as the TTN dashboard (no reverse LSB/MSB displayed) should match the 3 and I’ve done this to avoid scratching my head !!!

Did you created your device first on TTN dashboard and see it orange mark because not activated ?

If spi_scan see your device and ttn-otaa says nothing such as device not found, it’s that the wiring is good but you could also check reset line of device SX1272 should be 0 and SX1276 High, to be sure do not wire reset but on this hat not sure you can;-)

It works! Thanks! :smile:

Of course there was a typo in the appKey…:rolling_eyes:

@dermatthias
So I can say 95% of join error are related to bad keys :wink:

2 Likes

Your repository lmic_pi on github, did anyone get it up and running with a Draguino Lora/GPS HAT?

First there was this issue with the WiringPi library being initialized more than once, and after having fixed this, I get the follwing error message:

OhOh. Unknown interrupt flags for FSK

Do you have a clue why this happens?
Is there an incompatibility with the SX1276?

@wklenk

The repository https://github.com/hallard/arduino-lmic/tree/rpi
is not using WiringPI but BCM2835 library and @dermatthias have it working with Dragino Lora GPS hat

Are you you’re using the correct one ?

i removed the wiringPISetup only twice in the hal.c and left the one in thethingsnetwork-send-v1.cpp

and recieved messages on my thethings network dashboard!
my first lora emited signals: quite a victory :wink:

1 Like

I’m also using the dragino with raspberry. The spi scan gives me always nothing, also after reboot:

pi@raspberrypi:~/arduino-lmic-rpi/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=GPIO07 => Nothing!
Checking register(0x10) with CS=GPIO07 => Nothing!
Checking register(0x42) with CS=GPIO08 => Nothing!
Checking register(0x10) with CS=GPIO08 => Nothing!
Checking register(0x42) with CS=GPIO26 => Nothing!
Checking register(0x10) with CS=GPIO26 => Nothing!

If I run the ttn-otaa example, it’s stuck always at EV_JOINING, as with you at the beginning:

pi@raspberrypi:~/arduino-lmic-rpi/examples/raspi/ttn-otaa $ sudo ./ttn-otaa
ttn-otaa Starting
RFM95 device configuration
CS=GPIO25 RST=GPIO17 LED=Unused DIO0=Unused DIO1=Unused DIO2=Unused
DevEUI : ****
AppEUI : ****
AppKey : ****
17:05:32: Packet queued
17:05:32: EV_JOINING

The key’s are correct, they are the same as in the TTN. Do I have to do some wiring at the pins (connecting to DIO1 and DIO2)? I use the pin config as it is in the example:

#define RF_CS_PIN  RPI_V2_GPIO_P1_22
#define RF_IRQ_PIN RPI_V2_GPIO_P1_07
#define RF_RST_PIN RPI_V2_GPIO_P1_11

Thanks in advance for your reply!

Did you get an answer to this problem after all?

@phvan
Sorry about this, there is a mistake on spi_scan.c, for dragino shield it’s BCM GPIO25 and not GPIO6 to set on line 77-78

lines should be replaced by

// GPIO8/CE0, GPIO7/CE1, GPIO25 and GPIO26
uint8_t CS_pins[] = { 7, 8, 25, 26};

Then after change run make and execute the new build file

root@pi03(rw):~/arduino-lmic/examples/raspi/spi_scan# ./spi_scan
Checking register(0x42) with CS=GPIO07 => Nothing!
Checking register(0x10) with CS=GPIO07 => Nothing!
Checking register(0x42) with CS=GPIO08 => Nothing!
Checking register(0x10) with CS=GPIO08 => Nothing!
Checking register(0x42) with CS=GPIO25 => SX1276 RF95/96 (V=0x12)
Checking register(0x10) with CS=GPIO25 => Nothing!
Checking register(0x42) with CS=GPIO26 => Nothing!
Checking register(0x10) with CS=GPIO26 => Nothing!
root@pi03(rw):~/arduino-lmic/examples/raspi/spi_scan#

But it’s just for spi_scan, ttn-otaa should works with your settings, just tested with current repo with Dragino HAT V1.0, no problem, are you sure you’ve got a working gateway around there ?

root@pi03(rw):~/arduino-lmic/examples/raspi/ttn-otaa# ./ttn-otaa
ttn-otaa Starting
RFM95 device configuration
CS=GPIO25 RST=GPIO17 LED=Unused DIO0=Unused DIO1=Unused DIO2=Unused
DevEUI : ****
AppEUI : ****
AppKey : ****
21:11:54: Packet queued
21:11:54: EV_JOINING
21:12:01: EV_JOINED
21:12:07: EV_TXCOMPLETE (includes waiting for RX windows)
^C
Break received, exiting!
ttn-otaa, done my job!

@Charles

Tanks for your response. SPI scan now works and shows result: Checking register(0x42) with CS=GPIO25 => SX1276 RF95/96 (V=0x12)

ttn-otaa still stucks at EV_JOINING

Yes, I have a running gateway. It’s also built with a raspberry and a dragino hat using the single channel packet forwarder (https://github.com/hallard/single_chan_pkt_fwd). Gateway shows up as “active” in my ttn console, so i think gaetway should work.

If I lookup the gateway under http://staging.thethingsnetwork.org/gatewaystatus/ it shows up as:

EUI              UPLINK   DOWNLINK  LAST_SEEN
*********        active   N/A       now

Is there a possibility to see why it isn’t working (log files)?
I’m using Dragino HAT v1.1. Maybe this is the problem? Or whats the difference to v1.0?

Tried it also with Dragino HAT v1.0. Same here, also stucks at EV_JOINING
Key’s are the same as in ttn, gateway shows up in ttn.

I don’t know what the problem is.

did you had a chance to see the log on the gateway side ?

I suggest also you migrate your node declaration to new TTN environment (no staging)
see
https://www.thethingsnetwork.org/forum/t/launching-production-environment/

@Charles

Many thnaks for your answer. I’m already using the new TTN environment. Gateway is connected to router.eu.thethings.network and in the TTN console i created a gateway and an application with a device (node).

If I run the ttn-otaa on the node, following is displayed in the log of the gateway:

Jan 03 17:17:25 raspberrypi single_chan_pkt_fwd[4907]: stat update: 2017-01-03 17:16:17 GMT 1 packet received
Jan 03 17:17:25 raspberrypi single_chan_pkt_fwd[4907]: stat update: 2017-01-03 17:16:47 GMT 1 packet received
Jan 03 17:17:25 raspberrypi single_chan_pkt_fwd[4907]: stat update: 2017-01-03 17:17:17 GMT 1 packet received
Jan 03 17:17:25 raspberrypi single_chan_pkt_fwd[4907]: Packet RSSI: -35, RSSI: -100, SNR: 9, Length: 23 Message:'.v...~..p...,>.'.oB.*.e'
Jan 03 17:17:25 raspberrypi single_chan_pkt_fwd[4907]: rxpk update: {"rxpk":[{"tmst":3616271931,"freq":868.1,"chan":0,"rfch":0,"stat":1,"modu":"LORA","datr":"SF7BW125","codr":"4/5","rssi":-35,"lsnr":9.0,"size":23,"data":"AHYdAPB+1bNwAATuLD7rJ7hvQqYqBGU="}]}

Afterwards in the TTN console (console.thethingsnetwork.org) the received messages of the gateway are counted up:

So if I understand this correct, messages from the node are sent to the gateway and somehow also forwarded to ttn, or why else should messages be counted up?
But the device (node) in my application still shows up as inactive and ttn-otaa still stucks at EV_JOINING:

I have already spent several weeks now, trying to get this running. But I don’t see where possibly my mistake is. Do I have to do some more config in the ttn console?
Does anyone already got this running (new ttn environment, two raspberry, one as gateway, one as node, with dragino hat)?

Are you using a single channel gateway? Then you are probably out of luck for OTAA as the software on most single channel gateways does not transmit. OTAA requires the gateway to transmit data to the node. Try ABP.

1 Like

Yes I’m using a single channel gateway. So the alternative would be to build another gateway than a single channel to use OTAA?
Or is there a working example of a single channel gateway with OTAA (of course with dragino hat)?

thanks @kersing I missed that major SCG was not transmitting on OTAA, but this is definitively the issue

There should be code for an ESP8266 based single channel gateway that does send data. I’m not sure the production back-end will still send data to single channel gateways. (@htdvisser should this still work?)

We can use single-channel gateways for uplink messages only. They might currently also be used for scheduling downlink, but that will change.

@thinginnovations, it appears the link you show in this thread is broken

Cheers

gipsybles