Trying to get the LoRaWAN example to work

I’ve recently picked up an interest in LoRa and LoRaWAN, and have started experimenting with it a few weeks ago. Unfortunately, I’ve not have had much success so far…

I’ve been hesitant to open a new topic since there were already two other Lorawan topics active and maybe the answer to my problems would also pop up there, but unfortunately I think that is not the case. So another topic it is!

What hardware am I using?

I bought one Dragino Raspberry Pi hat running on an RPi2 and use it as a gateway to TheThingsNetwork.

I also bought a couple of devices that I intended to use as a node. One of them is this esp32 lorawan stick. If I’m not mistaken, this one is supported by RIOT under the name “esp32-heltec-lora32-v2”.

What works?

I installed the dual_chan_pkt_fwd software according to the Dragoni install guide. When I fill in the correct credentials it shows up on my TTN dashboard as “connected”. I flashed examples/lorawan on the heltec board (of course, again with the correct credentials). When I reset the board, I can see traffic in the dump of the gateway. Thus, the node is able to connect to the gateway. The TTN dashboard also confirms this: when I check the Traffic tab it shows two incoming Join requests (not sure why there’s two?) and a Join Accept message. So… the node is able to reach TTN through my gateway without any problems, and TTN also accepts its request to join the network. The Device page also confirms this: it shows one Activation package, and shows “Connected” as the device status. (Or something along the lines of “last seen: 10 seconds ago”) (See screenshots below)

Then what’s the problem?

Well… This is where the good news ends. Even though TTN reports a successful join, RIOT reports a failure:

 2021-02-08 22:00:49,293 # rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
2021-02-08 22:00:49,295 # configsip: 0, SPIWP:0xee
2021-02-08 22:00:49,301 # clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
2021-02-08 22:00:49,303 # mode:DOUT, clock div:2
2021-02-08 22:00:49,305 # load:0x3fff0018,len:4
2021-02-08 22:00:49,308 # load:0x3fff001c,len:4004
2021-02-08 22:00:49,310 # load:0x40078000,len:7304
2021-02-08 22:00:49,312 # load:0x40080000,len:7224
2021-02-08 22:00:49,314 # entry 0x40080350
2021-02-08 22:00:50,026 # RTC: Not found External 32 kHz XTAL. Switching to Internal 150 kHz RC chain
2021-02-08 22:00:50,078 # [rtt] 32.768 kHz crystal not used!
2021-02-08 22:00:50,078 # 
2021-02-08 22:00:50,081 # [rtt] 32.768 kHz crystal not used!
2021-02-08 22:00:50,086 # main(): This is RIOT! (Version: 2021.04-devel-229-g83201)
2021-02-08 22:00:50,089 # LoRaWAN Class A low-power application
2021-02-08 22:00:50,092 # =====================================
2021-02-08 22:00:50,096 # [semtech-loramac] initializing loramac
2021-02-08 22:00:50,152 # Starting join procedure
2021-02-08 22:00:50,156 # [semtech-loramac] Starting join procedure: 0
2021-02-08 22:00:50,158 # [semtech-loramac] loramac cmd msg
2021-02-08 22:00:50,162 # [semtech-loramac] starting OTAA join
2021-02-08 22:00:50,258 # [semtech-loramac] Transmission completed
2021-02-08 22:00:51,193 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:52,194 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:53,194 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:54,194 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:55,194 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:55,203 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:56,062 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:56,195 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:57,195 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:58,195 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:58,206 # [semtech-loramac] RX timer timeout
2021-02-08 22:00:59,195 # [semtech-loramac] MAC timer timeout
2021-02-08 22:00:59,198 # [semtech-loramac] MLME confirm event
2021-02-08 22:00:59,202 # [semtech-loramac] MLME confirm msg received
2021-02-08 22:00:59,205 # [semtech-loramac] join not successful
2021-02-08 22:00:59,207 # Join procedure failed

I’ve been trying to find the cause, but have thus far failed to do so…

Some screenshots of the TTN-dashboard:

Anyone have an idea what might be going wrong and how I can get it to work?

Hey,

Can you enable debug and flash ? Then post the entire log ? You can do a flash and then reset the board to see the complete log.

Are you sure that its one from heltec? There are quite a large number of OEM’s making similar ones with small changes to even replacing the radio chip with equivalent. In most cases, it an issue with the stack not getting a reply from radio. Please check DIO0 here , if not right you can do a remap.

BTW, please mask your keys while sharing screenshots :crazy_face:

Hi akshaim, thanks for your reply!

Can you enable debug and flash ? Then post the entire log ? You can do a flash and then reset the board to see the complete log.

Is it possible that debug was already enabled in the dump I pasted above? The debug prints are the ones prefixed with [semtech-loramac]. Unless there’s another debug you want me to enable?

Are you sure that its one from heltec?

It does have the Heltec logo all over the board, so I’m assuming it must be Heltec’s? Unless some other manufacturer stamped Heltec’s logo ontop of it for fraudulent reasons…

There are quite a large number of OEM’s making similar ones with small changes to even replacing the radio chip with equivalent. In most cases, it an issue with the stack not getting a reply from radio. Please check DIO0 here , if not right you can do a remap.

This does make a lot of sense, yes. Any suggestion on which pins are common? That way I can try those first, before brute forcing all options :slight_smile:

BTW, please mask your keys while sharing screenshots :crazy_face:

You’re right. I should have blurred them. I didn’t bother because they’re currently only used for testing and I will probably delete them and generate new ones once I have everything working. (However, the codes in the screenshots are not keys, but IDs. Keys are hidden by default on TTN. You have to click the eye-icon to unblur them). I’ll black’m out in the future though. Thanks for pointing it out!

EDIT: I found this online:

Apparently it’s called “Heltec Panda Board”. According to this schematic, DIO is indeed on Pin 26.

Hey,

Did you manage to make it work ?

If not, do you have any other LoRa/LoRaWAN node available with you ? If so can you test whether the node is able to receive packets using this test, use listen mode and see if you are able to view the raw packets transmitted by other nodes. If you are unable to receive packets its usually wiring problem

Hello @akshaim! My apologies for the very late reply. I tested the sx127x drivertest as per your suggestion in combination with the same raspberry Pi I use as a gateway, but this time as an example node.

At first it appeared like it didn’t receive anything, but after setting the channel correctly I received plenty of packets. It seems to me like the wiring is okay.

2021-03-06 01:03:57,203 # IN DIO0 ISR!!
2021-03-06 01:03:57,208 # {Payload: "HELLO" (5 bytes), RSSI: 179, SNR: 5, TOA: 37}
2021-03-06 01:03:57,210 # Data reception started
2021-03-06 01:04:02,205 # IN DIO0 ISR!!
2021-03-06 01:04:02,210 # {Payload: "HELLO" (5 bytes), RSSI: 182, SNR: 5, TOA: 37}
2021-03-06 01:04:02,212 # Data reception started

@Wosym Did you find any solution for you problem with joining in OTAA? Im stuck with exactly the same problem…

Not yet unfortunately. I bought some more hardware to do some testing (standalone lorawan module that should definitely work), but didn’t manage to get it to work the first time. Haven’t found the time to try some more since then.

I’ll try to give it another go somewhere in the upcoming weeks. I’ll keep you posted!

Okay, so you tried TX and RX on the node hence wiring should be okay. I suggest you try the following :

  • Please check if DR is between 0 and 2.
  • Can you change the Join Accept delay?

These configurations can be accessed by running make menuconfig in example folders examples/lorawan or examples/gnrc_lorwan

Hey,

A similar issue was discussed here <https://github.com/RIOT-OS/RIOT/issues/16419 > . Can you check ?

1 Like

Aha! Looks like his problem was solved in the meanwhile! I’ll read up and try to make the changes he did as soon as I find the time!

I had seen the Issue opened last week, and figured that it was the same person as this author. (Same ID’s in the screenshots and same terminal) But when I saw it it wasn’t solved yet.

Thanks for the heads up! I’ll let you know the results when I was able to run the experiments!

1 Like

Hi. I’m experiencing the same problem, namely I cannot join TTN, the procedure always fails showing the same debug messages you got. However, the esp32-heltec-lora32-v2 board works perfectly if I use arduino ide.

The setting of the arduino skect are the follwing

const lmic_pinmap lmic_pins = {
    .nss = 18, 
    .rxtx = LMIC_UNUSED_PIN,
    .rst = 14,
    //.dio = {/*dio0*/ 26, /*dio1*/ 34, /*dio2*/ 35}     // working with HELTEC Loro 32 v.2
    .dio = {/*dio0*/ 26, /*dio1*/ 35, /*dio2*/ 34}       // working with HELTEC Lora 32 v2. (HELTEC Doku)
};

which are indeed consistent with RIOT/board.h at master · RIOT-OS/RIOT · GitHub

except for the fact that

#define SX127X_PARAM_DIO1               GPIO_UNDEF /* GPIO35 has no pulldown, leads to init error */
#define SX127X_PARAM_DIO2               GPIO_UNDEF /* GPIO34 has no pulldown, leads to init error */

So I guess the issue could be hardware, namely GPIO34 and GPIO35 have no pulldown resistors. However, I don’t understand why the same exact configuration works on arduino ide without those resistors? What do you think? Can this be the problem?

Thanks in advance, Andrea

Welcome @Andrea_Vitaletti, and thanks for opening a new thread as well. Please continue this discussion there: Heltec v2 LORA to TTN working on Arduino not on RIOT