FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects...

16
FMLR Development Board High Performance LoRaWAN ® Development Board Quickstart Guide Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland Revision 1.0 1/16

Transcript of FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects...

Page 1: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

FMLR Development BoardHigh Performance LoRaWAN® Development Board

Quickstart Guide

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

1/16

Page 2: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

About this Document

Title FMLR Development Board

Subtitle High Performance LoRaWAN® Development Board

Document Type Quickstart Guide

Revision 1.06

Date 2020/02/07

Document Status Preliminary

Contents

1 Overview................................................................................................................................................... 3

1.1 Connectors and UI................................................................................................................................. 3

1.2 Pin-out................................................................................................................................................... 4

2 First steps................................................................................................................................................. 5

2.1 Powering on the Device......................................................................................................................... 5

2.2 Programming the Device....................................................................................................................... 5

2.3 Access Serial Port of the Device by USB (UART).................................................................................6

3 Application Development and Debugging.................................................................................................7

3.1 Prerequisites......................................................................................................................................... 7

3.2 Connecting the Development Board using SWD Programmer..............................................................8

3.3 Getting the Sources............................................................................................................................... 9

3.4 Setting LoRaWAN Configuration.........................................................................................................10

3.5 Download and Debugging................................................................................................................... 11

3.6 Connection to a LoRaWAN Network Server........................................................................................14

4 Additional Information............................................................................................................................. 20

We reserve the right to make technical changes, which serve to improve the product, without prior notification.

SAFETY-CRITICAL, MILITARY, AND AUTOMOTIVE APPLICATIONS DISCLAIMER: Miromico products are not designed for and will

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

2/16

Page 3: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

not be used in connection with any applications where the failure of such products would reasonably be expected to result in significant personal injury or death (“Safety-Critical Applications”) without an Miromico officer's specific written consent. Safety-Critical Applications include, without limitation, life support devices and systems, equipment or systems for the operation of nuclear facilities and weapons systems. Miromico products are not designed nor intended for use in military or aerospace applications or environments. Miromico products are not designed nor intended for use in automotive applications unless specifically designated byMiromico as automotive-grade.

1 Overview

1.1 Connectors and UI

Function DescriptionFMLR Module FMLR Module

LED User RGB LED for debugging or user purpose

TAG Connect Programming Interface for Tag Connect and Miromico programming adapter

Sensor SHT21 I2C environmental sensor

JTAG Connector Programming Interface for JTAG programmer

User Button For debugging or user purpose connected to PA0 of the MCU

Boot Mode Button Sets the Boot Mode of the FMLR Module

Micro-USB Port DC Input and debugging interface

Reset Button Resets and restarts the FMLR Module

LEDs Power and UART RX / TX LED

For more information on the FMLR Module please refer the the respective data sheets found on the Miromico website: miromico.ch/portfolio/fmlr_maxim/?lang=en

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

3/16

Page 4: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

1.2 Pin-out

Pin Details Min Max Unit

All Min / Max Voltage on All Pins -0.3 3.6 V

3V3 Input / Output Voltage Pin -0.3 3.6 V

VBUS Input / Output Voltage Pin -0.3 5.5 V

Warning:

Do not exceed the above mentioned max. voltage values

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

4/16

Function MCU Pad Pin FMLR-6x-MA62x Development Board – Pinout Pin MCU Pad Function

GND B01 P4.3 I/O

RESET RSTN RES# B02 P3.7 I/O

I/O P1.4 A03 B03 P0.2 I/O

I2CM0_SDA P1.6 A04 B04 P3.1 USART2A_TX

I2CM0_SCL P1.7 A05 B05 P3.0 USART2A_RX

BOOT P1.3 / SRSTN BM B06 P3.3 I/O

USART0A_RX P0.0 A07 B07 P2.5 SPI_MOSI

USART0A_TX P0.1 A08 B08 P2.6 SPI_MISO

Debug SWCLK SWCLK B09 P2.4 SPI_SCK

Debug SWDIO SWDIO B10 P4.0 I/O

USB_DP USB_DP A11 GND

USB_DM USB_DM A12 B11 P4.1 I/O

3V3 B12 AIN3 AIN3

I/O P1.5 A14 B13 P4.2 I/O

I/O P2.0 A15 B14 AIN1 AIN1

I/O P2.1 A16 B15 AIN0 AIN0

I/O P2.2 A17 B16 P3.6 I/O

I/O P2.3 A18 GND

I/O P3.2 A19 GND

VUSB GND

Page 5: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

2 First stepsThis section will guide you through the initial setup of the FMLR Development Board. You only need a Micro-USB cable to power the device and see Debug Output. Using more advanced tools, you can directly develop, download and debug your own application on the development board

2.1 Powering on the Device

The FMLR Development Board uses a standard Micro-USB connection to power and provide access to the serial port of the MCU.

1. Plug the USB cable to Micro-USB connector.

2. Plug the other end of the Micro-USB cable to the USB port of your computer.

3. The green power LED comes up. – you are ready to go

2.2 Access Serial Port of the Device by USB (UART)

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 settings:

Baud-rate 115200

Data-bits 8

Parity Even

Stop-bits 1

Flow Control None

You should now be able to see the debug output of the FMLR Module.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

5/16

Page 6: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

3 LoRaWAN Application DevelopmentWith this FMLR Development Board you can start developing your own LoRaWAN application.

3.1 Working 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.

Install WSL

- Follow Microsoft online documentation to install WSL

- Open Power Shell as Administrator.

- Run the following command

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

Install Ubuntu for WSL

Install Ubuntu 18.04 LTS which is available from Microsoft Store. After the installation is done and your personal user has been created, update the Ubuntu installation:

$ sudo apt update

$ sudo apt upgrade

Install development tools needed for the build (see https://doc.sm.tc/mac/gettingstarted.html ).

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

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

Install Python packages

$ pip3 install lz4 pycryptodome intelhexPyYAML

Working with WSL

As WSL does not have a graphical interface, source files must be installed on a path supported by Windows 10. 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 withing WSL.

Working with windows based Git tools does work, but extra care is needed.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

6/16

Page 7: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

3.2 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 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 are at:

https://doc.sm.tc/mac/

https://lora-developers.semtech.com/resources/tools/basic-mac/welcome-basic-mac/

3.3 Initialize Submodules

In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and basicmac repos have to be initialized and pulled by issuing the command:

$ git submodule update --init --recursive

3.4 Switch to the maxim branch

The same application can run on different HW platforms. For FMLR module with the Maxim microcontroller you need to checkout the maxim branch:

$ git checkout -b maxim origin/maxim

Update the submodules after switching the branch:

$ git submodule update --recursive

3.5 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 and type make:

$ cd application

$ make

A ".hex" file is generated, which can be downloaded using a debugger probe.

3.6 Downloading

You can download the generated .hex file in different ways.

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

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

7/16

Page 8: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

- Choose Device "MAX32625IWY", SWD, 4000kHz

- Click "OK"

- Erase Chip

- Choose your basicloader hex file

- Click "Program Device"

- Choose your application hex file

- Click "Program Device"

Miromico has break-out boards available to easily connect j-link programmers to Tag Connect connectors.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

8/16

Page 9: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

This break-out board also has a pin header to connect an FTDI cable for UART communication.

3.7 Setting LoRaWAN Configuration

In persodata.c the LoRa config is configured. (In more sophisticated projects, this data resides in a config section of the non-volatile memory)

eui = 0x0000000000000000ULL; memcpy(pd.deveui, &eui, 8); eui = 0x0000000000000000ULL; memcpy(pd.joineui, &eui, 8); uint8_t nwkkey[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; memcpy(pd.nwkkey, nwkkey, 16); memcpy(pd.appkey, nwkkey, 16);

If you use TheThingsNetwork LoRaWAN (TTN) to join your device as recommended below, you need to

acquire a unique DevEUI first. The AppEUI and the AppKey will be created in a random way by the TTN Web Application. The DevEUI, AppEUI and AppKey need to be configured in your LoRaWAN networkserver backend before you can configure them in the application. See chapter “Connection to a LoRaWAN Network Server” to learn how to register a device with TTN. Please note the AppEUI is sometimes also called JoinEUI. EUIs are 8 bytes long whereas the AppKey is 16 bytes long.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

9/16

Page 10: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

3.8 Connection to a LoRaWAN Network Server

To run and test a LoRaWAN sensor node you need to connect it to a LoRaWAN network server. For your first steps we recommend to use TheThingsNetwork LoRaWAN (TTN). You need to setup and connect your gateway in TTN. This chapter is a step-by-step guide on how to on-board a new sensor device on TTN. Similar steps need to be taken with any other LoRaWAN network server.

1. Log in to your TTN account and navigate to the console

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

10/16

Page 11: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

2. Select «Applications»

3. Fill the form and press Add application.The AppEUI is automatically generated by the Things Network

4. Your application will be created and is ready to add some devices.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

11/16

Page 12: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

5. Take note of your new Application EUI

6. To register your device select «register device»

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

12/16

Page 13: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

7. On the next screen enter a Device ID, your unique Device EUI. Note the App Key will be created automatically. Then press «Register» to complete the device registration.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

13/16

Page 14: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

8. In the device overview you will see the device EUIs and the key you need to copy over into the applications LoRaWAN configuration. By clicking the “<>“ icons you can switch the view between hex and C-stile display. By clicking the clipboard icon you can copy the displayed value to the clipboard for later copy&paste operation.

9. You are now ready to set the LoRaWAN configuration and build the application.Copy the EUIs and the key and continue at chapter „Setting LoRaWAN Configuration“. Then return here to start and join the device.

10. Build and download the application into the development board and click run.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

14/16

Page 15: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

11. TTN data display of LoRaWan Application

The message without payload (marked with an orange marker) is the join message.There is only one join message because the device joined at the first try.

By default the payload data is just displayed in hex format. If you want to decode the hex data you need to change Payload Format under Payloads Formats from “Custom” to “Cayenne LPP”.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

15/16

Page 16: FMLR Development Board - miromico.ch · 3.3 Initialize Submodules In order to keep projects modular, we use git submodules. After cloning the ex-join repository, the extensions and

12. Console log of the Miromico LoRaWan Application

The FTDI-Cable (TTL-232R-3V3) creates a virtual COM device on Windows PCs.Connecting a console program to the COM device allows to log the UART messages logged by the LoRaWan application.See chapter “Access Serial Port of the Device by USB (UART)” for correct settings.

Below you can see:boot-messages, successful joining messages (JOINED) and data transfer messages

4 Additional InformationThis chapter is a collection of additional information once the first steps of bringing up your first LoRaWANsensor node have successfully been completed.

• With most operators LoRaWAN DevEUI need to be unique and from an official IEEE number range.

Miromico AG - Gallusstrasse 4 - CH-8006 Zurich – Switzerland

Revision 1.0

16/16