Getting the STM32 Discovery / Nucleo boards to work with TTN

For those of you who were also a bit ‘underwhelmed’ by the results of the Murata workshops I have created a writeup of what I needed to do to finally get the STM32 Discovery board to join TTN:

Getting started with STM32 LoRaWAN

The article is about the STM32 LoRa Discovery kit handed out during the Murata workshop, but is probably also useful for the Nucleo-64 / LoRa expansion board set handed out at the STMicro stand. Please let me know if you have any questions or if anything needs to be added?

Thanks!
M.

3 Likes

Looks like a lot of work to use the ST tools to get this going, might be easier to use Arduino for devices embedded with the Murata module.

3 Likes

stm-muratadev

Depends on what you want to accomplish I guess. Setting up the dev toolchain is a one-time pita. However, the result is a much more professional environment which is far more capable than the Arduino IDE, which is very limited IMHO.
The included libraries and projects also seem to be much better structured and designed (which I agree may be overkill when you’re trying to design a simple sensor node).

The downside of the STM32 toolchain is that it is not supported on macOS so I have to use a windows system. An alternative is to use Eclipse IDE but this is an even bigger pita to get working with the STM32 tools.

Andrew

“a much more professional environment which is far more capable than the Arduino IDE”

Ok, interesting. First off I am the poor soul doing this Arduino stuff for CMWX1ZZABZ … I use emacs as text editor, gcc compiles on the command line too, gdb is in another xterm tab, and yes, I use openocd directly to flash/debug (did I mention that I use Linux ?). I do not use the Arduino IDE to develop, as it is too limiting, right ?

Not quite. Since I implemented the LoRaWAN class (LoRaWAN.h) I actually started to play more with LoRaWAN/TTN than all the time when I was working on StackForce’s LoRaMac-node code. Why ? Because the Arduino style of uttmost simplification allows you to play with a few lines of code.

Here a simple example for US915/TTN:

void setup( void )
{
    LoRaWAN.begin(US915);
    LoRaWAN.setSubBand(2);
    LoRaWAN.joinOTAA(appEui, appKey, devEui);
}

void loop( void )
{
    delay(10000);

    if (!LoRaWAN.busy() && LoRaWAN.joined())
    {
        LoRaWAN.beginPacket();
        LoRaWAN.write(0xef);
        LoRaWAN.write(0xbe);
        LoRaWAN.write(0xad);
        LoRaWAN.write(0xde);
        LoRaWAN.endPacket();
    }
}

I am not saying that’s the best possible way, the best example or whatever. But reading the various threads here, the biggest problem folks have with nodes is to join a network at all. How many lines of code is the equivalent functionality with LMIC/LoRaMac-node ?

Ah, and if I wanted to get power consumption down to 2uA, I’d replace “delay(10000)” by “STM32L0.stop(10000)”. Done. Problem solved.

How much work do you have to invest with the more professional setup to get to the same point ?

Just found that myself a tad interesting, because yes, with a professional toolchain setup, you might have the ability to create more complex things (perhaps), but you pay a steep price.

4 Likes

The Things Network brings professionals and hobbyist / students together… so if you code with free or professional tools, that doesn’t matter, we can learn from each other imho.
The Things Conference was a good example… I am convinced that TTN have set a new ‘standard’ for these type of events.

4 Likes

Hi Thomas,
I did not mean to diminish the usability of Arduino in any way. If you are fine with using the existing libraries or edit these with other tools (I usually use VS Code) then yes, using the Arduino IDE is totally fine. It will probably get you the results you need in less time; which is especially important when prototyping.
However, as a developer i also want to be able to load and edit an entire project including all code in external libraries, like the individual sensor code files and the HAL layer. I like Keil MDK so far because it allows me to do that, build the project and upload it into the STM32 board, all in the same IDE.

There’s different tools for every goal; that’s why I usually try to use all all of them (at least once). I will probably also try to use Eclipse in the near future, see what they have to offer.

2 Likes

Did anyone tried to use PlatformIO in VS Code or Atom to get the board running? It is supported by the PlatformIO, so it should be easier to set this up instead of using the STM toolchain.

Much Agreed, More professional, Although I am a bit biased as I have been using STM32’s for many years under Eclipse and gcc and found getting started easy.

From the responses here i understand they didn’t use the mbed online compiler. Any idea why ?

It’s supported ( see : https://os.mbed.com/platforms/ST-Discovery-LRWAN1/ and http://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-eval-tools/stm32-mcu-eval-tools/stm32-mcu-discovery-kits/b-l072z-lrwan1.html ).

In general mbed is fairly painless : a web-based editor and compiler. No installation and modern C / C++. All you need is and account (free) and a usb cable.

Cheers, Ivo

I would agree with using mbed online compiler. Except that the LoRaWAN demo from STM currently only fully supports the original STM LoRa add-on board (https://os.mbed.com/components/SX1276MB1xAS/) and the USI-based board (http://www.st.com/en/evaluation-tools/i-nucleo-lrwan1.html).
Check out https://os.mbed.com/compiler/#nav:/LoRaWAN-demo-76;

I would love to try out the same demo on the B-L072Z-LRWAN1…

1 Like

LoRaWAN on the B-L072Z-LRWAN1 board is not working via mbed. Tried a few libraries that say it does work but it doesnt. Having to use uVision and the STM32 LoRaWAN code to get it working. Not idea and its taking a lot longer to develop product with. There are a number of areas of the LoRa code that need changing to support anything other than hardcoded values in a test environment.

Andrew

OK - not B-L072Z-LRWAN1, but here is a NUCLEO board - the STM32F103 variant with an Air9 LoRaWAN SPI module from modtronix in Australia running at 868MHz here in the UK using a ProAnt antenna mounted on an eval board running the standard Arduino TTN LMiC example.
// Pin mapping
const lmic_pinmap lmic_pins = {
.nss = PB6,
.rxtx = LMIC_UNUSED_PIN,
.rst = PA0,
.dio = {PA10, PB3, PB5},
};
Note that the NUCLEO-F103RB board is explicitly supported under Arduino board manager by the stduino STM32
IMG_20180322_213823707

1 Like

A new LoRaWAN stack implementation will be officialy made available in next 5.8.0 release of MBed https://os.mbed.com/blog/entry/QA-Webinar-Exploring-LoRa-with-Mbed/. It is already usable and support several boards, geographies, frequencies… https://os.mbed.com/teams/mbed-os-examples/code/mbed-os-example-lorawan/

The configuration of the library is easily performed thru a json file you edit, with all board and project specific, instead of editing the #define here and there. I’ve moved from Semtech Mbed library as it doesn’t seem to communicate anymore in its last version.

DISCO_L072CZ_LRWAN1, MTB_MURATA_ABZ, XDOT_L151CC, MTB_MTS_XDOT, LTEK_FF1705, MTS_MDOT_F411RE, MTB_ADV_WISE_1510, MTB_RAK811 and K64F are the out of the box supported boards and the configuration to support other LoRa modules is easy to understand.

5 Likes

I’ve tried the new LoRaWAN stack in the mbed-os 5.8 release and it works quite well but it still has issues and there are change requests in place to fix a downlink issue. Configuring devices by editing the json file is a pretty lame thing to be doing and should be avoided. The code does support runtime configuration and this is the option to be using.

I have used this on both the Multitech xDot and the Murata LoRaWAN module with the same basic code running on both.

Andrew

@dutchmcgyver I got up and running no problem with the toolchain. Question is, what files have to be modified to support US915_HYBRID && BAND1 for TTN support here in the US? Can’t seem to piece together where that is defined.

1 Like

Are there anyone who have tried STM32 Discovery board and Dragino LG01 gateway to work with TTN and have succeeded to join TTN with using OTAA ?

Though I have tried it and the activation message seems to reach to TTN
(based on “data” in “application menu” of TTN console),
I have not been able to succeed.

@ AkiraItoh

Got any luck? I have got the gateway connected to TTN, but I am not able to get the STM32 disco board connected to the gateway. Any input please? Thank you.

1 Like

Bonjour! merci de partager votre experience! SVP votre mail si c’est pssible j’ai quelques questions concernant l’utilisation du module Murta LoRWAN en lien descendant avec la classe C. Merci!