miro
Evaluation Kit for SX1261

 

P/N: DEV-FMLR-MAEVK3

Quick Start Guide

This document provides a step-by-step guide on how to use this board with LoRaWAN®

1. Unboxing

  • Development board

  • Antenna with U.FL connector

  • J-Link programmer

  • 2x USB Cables

2. Connecting

  • Development board with the USB cable to PC (Power and virtual COM port)

  • Antenna to development board

  • J-Link programmer debug probe to development board and PC

3. Developing

The development board comes with pre-loaded Firmware with the following features:

  • Blinking RGB LED at start-up

  • Reading sensor (temperature and humidity)

  • Joining over LoRaWAN

  • Periodic sensor read-out and transmit over LoRaWAN ® Follow the steps below to develop your own application :=)

4. EVKit pinout

EVKit pinout
Figure 1. EVKit pinout

5. Access the serial port of the EVK

In order to view the debugging output of the FMLR Module, you can use your preferred terminal application. (example: https://sourceforge.net/projects/y-a-terminal/)

Use the following setting:

Table 1. Settings for serial communication
setting value

baud-rate

2000000

data-bits

8

parity

even

stop-bits

1

flow control

none

You can now see the debug output of the pre-installed application. Now let’s develop your own LoRaWAN® application…​

6. Working with WSL under Windows

Basic MAC is developed under Linux, but it runs similarly under Mac or under Windows with a Linux subsystem. In this paragraph, the use of WSL (Windows Subsystem for Linux is explained) is explained.

WSL does not have a graphical interface. To use your preferred IDE (e.g. Eclipse), make sure the source files of your project are located on a path supported by Windows. You cannot access files within WSL from windows (e.g., your WSL home directory is not accessible!). WSL is mounting your windows drive(s) in /mnt. Your windows user directory is therefore accessible from WSL at /mnt/c/Users/<yourwinuser>. To avoid line ending and other issues (such as case sensitive file names), it is recommended to do important git operations such as checkout and commits directly from within WSL. Working with windows based Git tools does work, but extra care is needed.

7. Install WSL

  • Follow Microsoft online documentation to install WSL (e.g. Ubuntu 20.04.1 LTS from Microsoft Store)

  • Open Power Shell as Administrator.

  • Run the following command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

8. Update Ubuntu for WSL

After installation update Ubuntu:

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

9. Git, Python, OpenOcd, GDB

Install the following tools in your Ubuntu WSL

$ sudo apt-get install git gitk make python3.8 python3-pip openocd gdb-multiarch

You might need to do a reboot of the system and continue here.

10. GCC-ARM

Do not use the gcc-arm provided by Ubuntu, use the PPA packet.

$ sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install gcc-arm-embedded

Or, alternatively:

$ wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/9-2020q2/gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2
$ sudo tar xjf gcc-arm-none-eabi-9-2020-q2-update-x86_64-linux.tar.bz2 -C /usr/share/
$ sudo ln -s /usr/share/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc
$ sudo ln -s /usr/share/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-g++ /usr/bin/arm-none-eabi-g++
$ sudo ln -s /usr/share/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-gdb /usr/bin/arm-none-eabi-gdb
$ sudo ln -s /usr/share/gcc-arm-none-eabi-9-2020-q2-update/bin/arm-none-eabi-size /usr/bin/arm-none-eabi-size
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libncurses.so.6 /usr/lib/x86_64-linux-gnu/libncurses.so.5
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libtinfo.so.6 /usr/lib/x86_64-linux-gnu/libtinfo.so.5
$ sudo apt-get install gdb-multiarch binutils-arm-none-eabi

11. Install Python packages

Install the following python packages

$ pip3 install lz4 pycryptodome intelhex PyYAML

12. Getting the source code

Get Semtech’s LoRaWAN® implementation "Basic MAC". Get the latest example "ex-join" to show how to join a LoRaWAN® server at: https://gitlab.com/fmlr/fmlr-basicmac This is a fork of the official release from Semtech, but ported to the MAX32625/6 microcontroller (by miromico.ch) The official STM32 based release from Semtech can be found at https://github.com/lorabasics/basicmac More information about architecture and installation is at: https://lora-developers.semtech.com/ https://lora-developers.semtech.com/resources/tools/basic-mac/welcome-basic-mac/

13. Cloning the repository

$ git clone https://gitlab.com/fmlr/fmlr-basicmac/ex-join
$ cd ex-join
$ git submodule update --init --recursive

14. Building the projects

To build the Basic Loader, change to the basicloader directory and type make:

$ cd basicmac/basicloader/build/boards/FMLR-60-X-MAX32625/
$ make

To build the application, change to the application directory

$ cd application

Change the Makefile as shown below: Comment out the STM32L0 target, uncomment the Maxim target

#TARGET := fmlr_72_x_stl0
TARGET := fmlr_61_x_ma625

Build the project:

$ make

Concatenate the bootloader and the application by:

$ make combinebl

In the build-eu868 folder you can fi nd the build-output and executables.

15. Downloading your code to the EVKit

There are different ways how to download your code to your EVKit.

The LoRaWAN® StarterKit comes with the MAX32625PICO debugger probe.

  • Connect the MAX32625PICO board over the ribbon cable to the DevBoard, which is already connected over another USB cable to the PC.

  • Connect the MAX32625PICO board over USB intto the PC

  • A new Explorer Window appears

  • The "ex-join_combined.bin" can be drag-and-dropped to this new Explorer Window.

  • The new Explorer Window disappears for a second and reappears after downloading.

    • If the download failed the file named FAIL.TXT contains the error message

    • If the download succeeded there is not file named FAIL.TXT

More information about the DAP link project:

This example uses J-Link (https://www.segger.com/downloads/jlink/ ) under Windows:

  • Connect the DevBoard to the Debugger Probe. Note you can leave the USB cable connected

  • Start J-Flash Lite

  • Choose Device "MAX32625IWY", SWD, 4000kHz and click "OK"

  • Erase Chip

  • Choose your basicloader hex file and click "Program Device"

  • Choose your application hex file and click "Program Device" Miromico also provides break-out boards to easily connect the J-Link programmer and the FTDI cable over TagConnect to your target.

18. Comissioning your Device

In LoRaWAN® a device needs to be identified:

  • DevEUI: The Devices Extended Unique Identifier

  • JoinEUI (Or AppKey): links the device to back-end-application

  • NwKey: security key known by the the device and the back-end to encode/decode the messages.

In BasicsMac this is hard coded in the persodata.c file.

void pd_init (void) {

    persodata_v1* ppd = pd_check_v1((void*) PERSODATA_BASE);
    if( ppd ) {
        pd = *ppd;
    } else {
        uint64_t eui;
        eui = 0x1aa72bf228286c1bULL;
        memcpy(pd.deveui, &eui, 8);
        eui = 0xC41BF8F9B18348DAULL;
        memcpy(pd.joineui, &eui, 8);
        uint8_t nwkkey[16] = {0xc3, 0x7f, 0xdd, 0xee, 0x5c, 0xce, 0x29, 0x88, 0xdf, 0x84, 0xea, 0xe3, 0x41, 0xd1, 0xbe, 0x4a};
        memcpy(pd.nwkkey, nwkkey, 16);
        memcpy(pd.appkey, nwkkey, 16);
    }
}

DevEUIs are provided by the Manufacturer.

19. Using a LoRaWAN® network