[Solved] Sparkfun 1 ch gateway as Node: OTAA not working


I just setup my RAK 831 gateway with the balena tutorial.

Now I’m trying to use the Sparkfun 1 Ch gateway as a node. It embeds an ESP-WROOM-32 and an SX12276 on it. There is a procedure detailed on Sparkfun, but after several hours on it I still can’t achieve the OTAA.

My code is the same as the ttn-otaa example: https://github.com/mcci-catena/arduino-lmic/blob/master/examples/ttn-otaa/ttn-otaa.ino

My only modification, except the different IDs, is that I’ve specified a different pin mapping:
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = 16,
.rst = 5,
.dio = {26, 33, 32},

And in the setup I added this line after Serial.begin:
SPI.begin(14, 12, 13, 16);

Now my node output is as follow:
Packet queued
405766: Unknown event: 20
456892: EV_TXSTART
837080: Unknown event: 20

Did someone succeed in using this board as a node ?

when I read this I just think ’ WHY ??’

Why using this board ? :stuck_out_tongue:

I want to have both Lora and Wifi option on the same board. I guess I though it was a good dev board when I saw it :confused:

but isn’t that board 915 Mhz ? and you are in the EU ?

This could be a good point; however the biggest part of it would be if the firmware has the US bandplan rather than the appropriate EU one. 868 and 915 are close enough that the actual hardware may work to a degree if the correct frequencies are programmed.

Regional configuration seems to be at least here:

And possibly other places in the code as well

yes you’re right… and did you set the EU frequencies ? :wink:

Good one but I did setup the right frequency :wink:

// project-specific definitions
#define CFG_eu868 1
#define CFG_sx1276_radio 1

And for the Gateway, you can read in the documentation in the repo used to build the image:

FREQ_PLAN_URL optional - default https://account.thethingsnetwork.org/api/v2/frequency-plans/EU_863_870

I supposed it was already setup for EU GW then

EDIT: From the board description:

Hope RFM95W LoRa modem
- Frequency range: 868/915 MHz

So should be compatible

EDIT 2: My inly concern for debugging right now is that the balena interface is quiet short on debug messages. It only updates every two or three minutes to display this message but nothing really real time to know if the GW actually sees the join request:

##### 2019-04-09 22:51:48 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 0
# CRC_OK: 0.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 0 (0 bytes)
# PUSH_DATA datagrams sent: 0 (0 bytes)
# PUSH_DATA acknowledged: 0.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 0 (0.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
### [JIT] ###
# INFO: JIT queue contains 0 packets.
# INFO: JIT queue contains 0 beacons.
### [GPS] ###
# No time keeping possible due to fake gps.
# Manual GPS coordinates: latitude 43.58453, longitude 1.44242, altitude 0 m
# Upstream radio packet quality: 0.00%.
### [ CONNECTIONS ] ###
# bridge.eu.thethings.network: Connected
# Semtech status report send. 
##### END #####
INFO: [TTN] bridge.eu.thethings.network RTT 31
INFO: [TTN] send status success for bridge.eu.thethings.network

Make your node firmware serial print the frequencies and settings it transmits with. Compare to your gateway global / local / etc config files. Once you get the uplink side working, if the downlink isn’t yet do that all over again for the receive windows.

Ok, so I found where to enable debug logging, you have to uncomment this line in lmic/config.h:

#define LMIC_PRINTF_TO Serial

Then my output is:

4179: engineUpdate, opmode=0x8
Packet queued
4215: engineUpdate, opmode=0xc
502452: engineUpdate, opmode=0xc
502473: EV_TXSTART
502538: TXMODE, freq=868300000, len=23, SF=7, BW=125, CR=4/5, IH=0
812635: setupRx1 txrxFlags 00 --> 01
start single rx: now-rxtime: 3
812765: RXMODE_SINGLE, freq=868300000, SF=7, BW=125, CR=4/5, IH=0
rxtimeout: entry: 825582 rxtime: 812759 entry-rxtime: 12823 now-entry: 4 rxtime-txend: 306356
877182: setupRx2 txrxFlags 0x1 --> 02
start single rx: now-rxtime: 4
877313: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
rxtimeout: entry: 901906 rxtime: 877307 entry-rxtime: 24599 now-entry: 5 rxtime-txend: 370904
901927: processRx2Jacc txrxFlags 0x2 --> 00
902533: Unknown event: 20
904291: engineUpdate, opmode=0xc

Frequencies seems right, is the now-rx time normal ? (very small compared to other numbers)
I added this line in the setup but not very helpful:

LMIC_setClockError(MAX_CLOCK_ERROR * 2 / 100); // <-----

Regarding the GW, the setup is in the right frequencies:

10.04.19 09:49:16 (+0200)  main  07:49:16  INFO: radio 0 enabled (type SX1257), center frequency 867500000, RSSI offset -166.000000, tx enabled 1
10.04.19 09:49:16 (+0200)  main  07:49:16  INFO: radio 1 enabled (type SX1257), center frequency 868500000, RSSI offset -166.000000, tx enabled 0

I also set the env variable GW_LOGGER to true, now I see those lines:

10.04.19 09:44:04 (+0200)  main  07:44:04  INFO: [stats] received packet with bad CRC from mote: 9151CDC9 (fcnt=24032)
10.04.19 09:44:26 (+0200)  main  07:44:26  INFO: [stats] received packet with valid CRC from mote: 7ED5B370 (fcnt=42753)
10.04.19 09:44:26 (+0200)  main  07:44:26  INFO: [up] TTN lora packet send to server "bridge.eu.thethings.network"

But on TTN console, the GW traffic is empty :confused: Yesterday it did show some messages received (not from my device) so I though it was working fine.

Stupid question: we can see 8 chars long IDs in the log (7ED5B370 for example), what is it ? Node EUIs are on 16 chars


I found what was the Unknown event, the EV_JOIN_TXCOMPLETE wasn’t in the switch case, so now I have:

77146: TXMODE, freq=868500000, len=23, SF=7, BW=125, CR=4/5, IH=0
387243: setupRx1 txrxFlags 00 --> 01
start single rx: now-rxtime: 4
387373: RXMODE_SINGLE, freq=868500000, SF=7, BW=125, CR=4/5, IH=0
rxtimeout: entry: 400190 rxtime: 387367 entry-rxtime: 12823 now-entry: 4 rxtime-txend: 306356
451790: setupRx2 txrxFlags 0x1 --> 02
start single rx: now-rxtime: 3
451921: RXMODE_SINGLE, freq=869525000, SF=12, BW=125, CR=4/5, IH=0
rxtimeout: entry: 476514 rxtime: 451915 entry-rxtime: 24599 now-entry: 4 rxtime-txend: 370904
476534: processRx2Jacc txrxFlags 0x2 --> 00
478963: engineUpdate, opmode=0xc

But still no EV_JOINED event

:white_check_mark: Problem solved. Problem was between the board and the chair of course…

  • First, i didn’t solder the 0 ohm bridge to connect the UFL connector (might have been an issue)…
  • Second, I just didn’t take care of the LSB/MSB prerequisites for the different IDs. Now that I gave IDs in the correct format I can receive information with OTAA :slight_smile:

Thanks for the support, feel free to throw some tomatoes :tomato: at me :wink:

1 Like

Congrats! Carry on!

1 Like

:tomato: :tomato: :tomato: :tomato: :tomato: LOL

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.