LoRa Basics™ Modems: Walk-through

LoRa Basics™ Modem


The LoRa Basics™ Modem is an easy-to-use LoRaWAN® stack designed by Semtech. Published as an open-source software library, it enables communication between an Internet of Things (IoT) device built with a LoRa® chip and, optionally, Semtech’s LoRa Cloud™ services.

LoRa Basics Modem for 2.4GHz communication emulates the LoRaWAN Standard, but uses the 2.4GHz ISM band to allow worldwide operation and interoperability. It is also designed to run on any host microcontroller unit (MCU) together with an end-device application, making it simple to integrate with a custom platform and use case.

System architecture

Figure 1: System architecture

Architecture Overview

LoRa Basics™ Modem features two simple-to-use interfaces:

  • The Software API that your firmware can call directly for modem configuration, wireless communication, and access to high-level LoRa Cloud™ services

  • The MCU Hardware Abstraction Layer (HAL) that allows the simple adaptation of the Modem to an MCU

The modem then takes care of everything else: from managing timing to resource planning and allocation, from allowing the radio to access the device to accessing the LoRa Cloud Modem & Geolocation Services provided through Semtech’s LoRa Cloud portal. All of this with a fully open-source software architecture intended to facilitate the evolution of the software toward the integration of new features, services, and even future MAC protocols.

An efficient multi-protocol-stack feature has been implemented, one that uses a dedicated radio planner. This simplifies radio resource management by preventing direct access to the low-level radio drivers. This innovation allows multiple communication stacks to work concurrently, whilst using the same hardware resources. For even more flexibility, the modem can run either with an embedded OS or without (bare metal) allowing simple integration into a platform.

LoRa Basics Modem architecture

Figure 2: LoRa Basics Modem architecture


The code runs on a microcontroller, which must meet the following minimum requirements:

  • 100 KB flash

  • 16 KB SRAM

  • low-power timer

  • dedicated SPI to drive the radio chip


By default, only an ST Nucleo-L073RZ target development board is supported. To use a different board follow the porting guide available here.

Setting-up the Code

The software can be downloaded from Github.

Configuring the Software

  1. Open the user_app/main.c file.

  2. In lines 97-99: enter the appropriate values for the user_dev_eui, user_join_eui, and user_app_key fields. (They should match values defined in Network Server Setup.)

  3. In lines 37-38: choose either the MAIN_EXAMPLE_EXTI application or the MAIN_EXAMPLE_ALARM_FILE_UPLOAD application.


What these applications do:

  • The MAIN_EXAMPLE_EXTI application sends a temperature reading when the blue button on the Nucleo board is pressed.

  • The MAIN_EXAMPLE_ALARM_FILE_UPLOAD application sets up a random alarm in the 60- to 120-second range and then uploads a file when the alarm is triggered.

Compiling the Software and Programming the Modem

Compile the project using the make -j modem_2_4 command.


This command needs the gcc-arm-non-eabi binary to be in your operating system’s path. If this is not the case, download it from the Arm website, extract it on your computer (ex: c:\gcc-arm-non-eabi), and run the command make -j GCC_PATH="c:\gcc-arm-non-eabi\bin" modem_2_4

Next, copy the build_modem_2_4/soft_modem_2g4.bin file to the Nucleo board’s temporary drive.


If the drive is not mounted under Windows, the necessary ST-Link driver may be missing. To obtain this driver, visit ST’s Nucleo-L073RZ product page and download STSW-LINK009.

Running the Demo

Serial Console

By default, the modem will log events to the serial console. The connection parameters are as follows:



Data bits




Stop bits


Flow control



This example sends the microprocessor temperature every time the blue button on the Nucleo board is pressed. The value is then displayed in a Node-RED graph.


This example sets an alarm to a random value between 60 and 120 seconds. When the alarm is triggered, the modem sends an event to the application, at which point a new file upload starts.