Problems getting the lorawan example to work with custom board

Hey everyone,

We are students who want to use lorawan for a project and are currently trying to get the riot lorawan example to work with our board. We are using an adafruit-feather-nrf52840-sense with an Seeedstudio SX1262 connected via SPI. For that, we copied the adafruit-feather-nrf52840-sense folder and added the definitions for the radio connection. You can find our board folder here: OpenSensSystem / OpenSensBoard / adafruit-feather-nrf52840-sense-lorawan · GitLab

We copied the example code to a new repo, changed the board, keys, riotbase path, region (EU868) and radio driver and added our board folder to RIOT/baords. You can find our code here: Files · master · OpenSensSystem / OpenSensBoard / lorawan_test · GitLab

When running the program we get the log in the screenshot (starting OTAA and then repeatedly “MAC timer timeout”) everytime.

Since a deep-dive into the semtech-loramac packge didn’t really answer the question of why we get the MAc timer timeout errors and since we noticed that we’re missing a lot of debug messages that would indicate the Join procedure is actually happening, we started to wander if maybe our custom Makefiles are the problem, if maybe we aren’t really sending anything at all.

Hardware is verified and works with arduino and radiolib 7.x We use a lorawan 1.04 device over the TTN.

Really looking forward for your suggestions

Welcome to the community and forums.

Unless I have missed something, I don’t see how your test application is making use of your custom board definition. So your test app is making use of the board definition provided by RIOT instead.

Hi @Maya, welcome to the community!

These “MAC Timer timeout” messages are the ticks of the Semtech pkg, which is used to perform steps in the internal state machine. It’s normal to see them every one second.

Since this involves a “new board”, I would try some sanity checks before trying to join a LoRaWAN network.

  1. Flash tests/drivers/sx126xon your device and verify that the radio is working (e.g send data between 2 devices). If initialization fails, the problem is likely the pin settings.
  2. Try ABP activation instead of OTA. In some cases, timing issues may prevent successful over-the-air activation.
  3. Check whether the gateway receives data from the nodes.

In any case, you may also try the in-house implementation (GNRC LoRaWAN) under networking/gnrc_lorawan. It’s in general easier to use and to debug.

hi, I don’t really understand why the app isn’t using our board definition. Could you explain that? I set the board variable in lorawan_test/Makefile to “adafruit-feather-nrf52840-sense-lorawan” and added this folder to RIOT/boards. I thought this was enough so the app would use the specified board? Our board definition is mostly the same as the adafruit-feather-nrf52840-sense, because we are using a adafruit-feather-nrf52840-sense board, but we added /**

* @name sx1262 configuration

* @{

*/

#define SX126X_PARAM_SPI SPI_DEV(0) // siehe periph_conf.h

#define SX126X_PARAM_SPI_NSS GPIO_PIN(1, 8) // D5

#define SX126X_PARAM_RESET GPIO_PIN(0, 7) // D6

#define SX126X_PARAM_DIO0 GPIO_PIN(0, 26) // D9

#define SX126X_PARAM_DIO1 GPIO_PIN(0, 27) // D10 to board.h since we connected the radio and the board via spi. Are we still missing something?

Hi, thanks for the explanation and the suggestions! I just ran the driver test and it seemed to work just fine.

(since I only had one device I just tested if the commands did something, but if the pin configuration was the problem that shouldn’t have worked, right?)

When we started testing lorawan we did look at the gateway, but we never received anything while using riot os.

Hi @Maya ,

the device seems to be working.

Could you try whether examples/networking/gnrc_lorawan works for your use case or not?