Getting Started with the FP-NET-6LPETH1 Software Package: Connecting 6LoWPAN IoT Nodes to the Internet via Ethernet Networks
UM2341 - Rev 1 - December 2017
Description
FP-NET-6LPETH1 is an STM32 ODE function pack that enables the connection of IoT nodes in a 6LoWPAN wireless sensor network to the Internet via an Ethernet network. This software, combined with specific STM32 and ST devices, can be used for applications such as smart city, home automation, building management, lighting control, or remote monitoring. It runs on the STM32 microcontroller and includes drivers for SPIRIT1-based sub-1GHz RF communication modules (SPSGRF-868 or SPSGRF-915). The software is built upon STM32Cube technology and extends existing STM32Cube-based packages.
For further information, contact your local STMicroelectronics sales office. Visit www.st.com.
Acronyms and Abbreviations
The following table lists common acronyms and their descriptions used in this document:
Acronym | Description |
---|---|
IDE | Integrated development environment |
BSP | Board support package |
DHCP | Dynamic host configuration protocol |
HAL | Hardware abstraction layer |
UDP | User datagram protocol |
6LoWPAN | IPv6 over low power wireless personal area networks |
RPL | Routing protocol for low power and lossy networks |
MCU | Microcontroller unit |
RF | Radio frequency |
OS | Operating system |
CoAP | Constrained application protocol |
LWM2M | Lightweight machine to machine |
IoT | Internet of things |
MEMS | Micro electro-mechanical systems |
GUI | Graphical user interface |
FP-NET-6LPETH1 Software Expansion for STM32Cube
Overview
The FP-NET-6LPETH1 software package enhances the functionality of STM32Cube. Key features include:
- Complete firmware for connecting 6LoWPAN and Ethernet networks.
- Middleware libraries supporting Contiki OS and the Contiki 6LoWPAN protocol stack 3.x.
- Support for mesh networking technology via the standard RPL protocol.
- Sample implementations for X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5 expansion boards connected to a NUCLEO-F429ZI board.
- Easy portability across different MCU families due to STM32Cube.
- Free, user-friendly license terms.
This software provides a sample application to connect 6LoWPAN network nodes to the Internet. Communication within the 6LoWPAN network is handled by the SPIRIT1 sub-1GHz radio (or associated expansion boards). The sample application routes all packets destined for the Internet through the Ethernet device on the NUCLEO-F429ZI board.
Detailed information on Contiki OS can be found in its Internals section. For Contiki APIs, refer to the documentation within the FP-NET-6LPETH1 package.
Architecture
The software is built on the STM32Cube HAL hardware abstraction layer for STM32 microcontrollers. It extends STM32Cube by providing a board support package (BSP) for Wi-Fi and sub-1GHz RF communication expansion boards. These drivers abstract low-level hardware details, allowing middleware components and applications to access sensor data and control SPIRIT1-based sub-1GHz RF communication modules (SPSGRF-868 or SPSGRF-915) in a hardware-independent manner.
The package includes a middleware library for a 6LoWPAN stack and a sample application to bridge IP packets between the 6LoWPAN and Ethernet networks. The device implements a "6to4" IP router functionality, converting 6LoWPAN network IPv6 packets into Ethernet network IPv4 packets.
The application software interacts with the X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5 expansion boards through:
- The STM32Cube HAL driver layer: Provides simple, generic, multi-instance APIs for interaction with upper layers, promoting code reusability and portability.
- The board support package (BSP) layer: Supports board-specific peripherals (like LEDs, user buttons) on the STM32 Nucleo board, excluding the MCU itself. This interface aids in identifying specific board versions.
Figure 1. FP-NET-6LPETH1 software architecture description: The software architecture diagram shows the STM32Cube HAL layer at the base, supporting the Board Support Package (BSP) for RF communication modules. Above the BSP is the Middleware layer, which includes the Contiki OS and 6LoWPAN stack. The Application layer sits at the top, interacting with the middleware and utilizing the drivers. Connections are shown between the RF expansion board, the STM32 MCU, and the Ethernet interface.
Folder Structure
Figure 2. FP-NET-6LPETH1 package folder structure description: The folder structure diagram illustrates the organization of the FP-NET-6LPETH1 software package. Key folders include 'Documentation' for API details, 'Drivers' for hardware abstraction and board-specific drivers, 'Middlewares' for the Contiki OS and 6LoWPAN stack, and 'Projects' containing sample applications for various IDEs.
The software package includes the following folders:
- Documentation: Contains a compiled HTML file detailing software components and APIs, generated from source code.
- Drivers: Houses HAL drivers and board-specific drivers for supported platforms, including on-board components and the CMSIS vendor-independent hardware abstraction layer for ARM Cortex-M processors.
- Middlewares: Contains libraries for the Contiki OS with the 6LoWPAN stack.
- Projects: Includes sample applications for bridging 6LoWPAN and Ethernet networks. Projects are built for NUCLEO-F429ZI boards and support the following development environments: IAR Embedded Workbench for ARM, RealView Microcontroller Development Kit (MDK-ARM), and System Workbench for STM32 (SW4STM32).
APIs
Detailed descriptions of user APIs, functions, and parameters are available in a compiled HTML file located in the Documentation folder of the software package.
Sample Application Description
System Overview
A sample application named "IP64Router", found in the Projects
directory, provides ready-to-build projects for multiple IDEs. Its functions include:
- Translating IPv6 packets to IPv4 packets using NAT64 technology.
- Creating a bridge between a 6LoWPAN network and the Internet using Contiki OS and the Ethernet transceiver.
Figure 3. Overall system architecture description: The overall system architecture diagram depicts a 6LoWPAN network of wireless sensor nodes on the left, connected via an STM32 Nucleo board acting as a bridge to an Ethernet network on the right. The Ethernet network is connected to the Internet through a standard router. The bridge translates IPv6 packets from the 6LoWPAN network to IPv4 packets for the Ethernet network using NAT64 technology.
Important:
- The diagram illustrates a 6LoWPAN network of wireless sensor nodes (implemented using STM32 Nucleo boards with sub-1GHz and sensor expansion boards) on the left, and an Ethernet network connected to the Internet via a standard router on the right. Refer to FP-SNS-6LPNODE1 for node firmware and documentation.
- The IPv4 address for the Ethernet interface is automatically obtained via DHCP. A DHCP server must be running on the router for correct system operation.
- The 6LoWPAN Ethernet bridge, running the FP-NET-6LPETH1 firmware on an STM32 Nucleo board with a sub-1GHz expansion board, connects these networks.
- Application servers or clients on the Internet can access data from wireless sensor nodes. For example, an OMA Lightweight M2M (LWM2M) server can manage devices and read sensor data from LWM2M clients on the nodes (see Section 2.5.2).
Procedure: How to run the IP64Router application
- Compile the project using a supported IDE (see Section 3.2 Software requirements).
- Connect the STM32 Nucleo board to your PC. A USB mass storage location will appear.
- Program the firmware by copying or dragging and dropping the binary file to the USB mass storage location. Alternatively, program directly via a supported development toolchain.
- Open a serial line monitor utility.
- Select the serial port for the board and configure the parameters: Baud Rate = 115200, Parity = None, Bits = 8, Stopbits = 1.
Wireless Sensor Node Setup using FP-SNS-6LPNODE1 (Optional)
To facilitate end-to-end solution testing between wireless sensor nodes and Internet servers, sample node applications are available as source code and pre-compiled binaries for STM32 Nucleo platforms with expansion boards. The software package for wireless sensor nodes is FP-SNS-6LPNODE1 (refer to UM2100 and the FP-SNS-6LPNODE1 quick start guide for detailed setup information).
Supported node configurations include:
- NUCLEO-F401RE plus X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5: Exposes common resources like LEDs and user buttons.
- NUCLEO-F401RE plus X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5 plus X-NUCLEO-IKS01A1: Exposes resources from the MEMS sensor expansion board (temperature, humidity, acceleration).
- NUCLEO-F401RE plus X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5 plus X-NUCLEO-6180XA1: Exposes resources from the FlightSenseTM expansion board (proximity sensor).
The FP-SNS-6LPNODE1 sample applications demonstrate connecting a node to a remote server using the OMA Lightweight M2M (LWM2M) standard. This technology uses CoAP (over UDP) to publish node resources in a standard LWM2M format, making them available online. The nodes attempt to connect to a public online server, Leshan, which is a Java implementation of an LWM2M server. Leshan also provides a GUI that communicates with the server via a REST API (see http://www.eclipse.org/leshan/).
The Leshan public LWM2M server is for evaluation purposes, demonstrating end-to-end connectivity between a wireless sensor node and an Internet-connected server via the 6LoWPAN-to-Ethernet bridge using the FP-NET-6LPETH1 package.
Figure 4. Client node registered on the remote server description: This figure shows a graphical representation of a client node successfully registered on a remote server, indicating successful network connectivity.
Figure 5. Leshan server: homepage description: The Leshan server homepage screenshot displays the main interface of the Leshan LWM2M server, typically showing server status and available clients.
Figure 6. Leshan server: client homepage description: The Leshan server client homepage screenshot shows details of a specific connected client, including its resources and status.
Figure 7. Leshan server: supported binding and modes description: This screenshot from the Leshan server illustrates the supported binding modes and communication protocols for connected clients.
Procedure: How to connect a remote wireless node to the Internet
- Power the STM32 Nucleo board using a Mini-B USB cable connected to the PC.
- Program the firmware on the STM32 Nucleo board by copying (or dragging and dropping) the binary file (located in the
/Utility/Binary
folder) to the USB mass storage that appears when the board is connected to the PC. - Open a serial line monitor utility.
- Select the serial port name to which the board is connected and configure the parameters: Baud Rate = 115200, Parity = None, Bits = 8, Stopbits = 1.
- Press the RESET (black) button on the STM32 Nucleo board and wait for the node to complete registration.
- Open Leshan (refer to figures for interface examples).
- Observe or read resources from the connected node via the Leshan interface.
System Setup Guide
Hardware Description
STM32 Nucleo-144 Platform
The STM32 Nucleo-144 boards offer an affordable and flexible platform for prototyping with various STM32 microcontrollers, balancing performance and power consumption. They feature the ST Zio connector (extending Arduino Uno V3 connectivity) and ST morpho headers for specialized shields. Integrated ST-LINK/V2-1 debugger/programmer eliminates the need for separate probes. The boards are supported by comprehensive STM32Cube software libraries and samples.
Figure 8. STM32 Nucleo-144 board description: The STM32 Nucleo-144 board is shown, highlighting its features for rapid prototyping, including the STM32 microcontroller, ST Zio connector for Arduino compatibility, ST morpho headers for expansion, and an integrated ST-LINK/V2-1 debugger/programmer.
Information regarding STM32 Nucleo-144 boards is available at www.st.com/stm32nucleo.
X-NUCLEO-IDS01A4 and X-NUCLEO-IDS01A5 Expansion Boards
These expansion boards provide a platform for evaluating the features of SPSGRF modules, based on the SPIRIT1 low data rate, low power, sub-1 GHz transceiver device. They can be plugged into the Arduino UNO R3 connectors of any STM32 Nucleo board. Other expansion boards can be stacked for evaluating different devices using sub-1 GHz communication. The boards include:
- Onboard SPSGRF module based on the SPIRIT1 sub-1 GHz transceiver.
- SPI EEPROM for parameter storage.
- LED for user interface.
- Jumper at 3V3 for checking expansion board current consumption.
Figure 9. X-NUCLEO-IDS01A4 / X-NUCLEO-IDS01A5 expansion board description: The X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5 expansion board is depicted. It features an SPSGRF module based on the SPIRIT1 sub-1 GHz transceiver, an SPI EEPROM, a user LED, and a jumper for current consumption checks.
Software Requirements
The following software components are necessary for setting up a development environment for STM32 Nucleo boards with RF expansion boards:
- FP-NET-6LPETH1 software, available on www.st.com.
- Development tool-chain and Compiler. The STM32Cube expansion software supports three environments:
- IAR Embedded Workbench for ARM® (IAR-EWARM) toolchain + ST-LINK
- RealView Microcontroller Development Kit (MDK-ARM) toolchain + ST-LINK
- System Workbench for STM32 (SW4STM32) + ST-LINK
Hardware and Software Setup
Hardware Requirements
For implementing the bridge, the following hardware components are required:
- One STM32 Nucleo-144 development platform (order code: NUCLEO-F429ZI).
- One SPIRIT1 expansion board (order code: X-NUCLEO-IDS01A4 (for 868 MHz), or X-NUCLEO-IDS01A5 (for 915 MHz)).
- One USB type A to micro USB type B cable to connect the STM32 Nucleo to the PC.
System Setup Guide
This section details the hardware setup before writing and executing an application on the STM32 Nucleo-144 board with an RF expansion board.
The STM32 Nucleo-144 board includes the ST-LINK/V2-1 debugger/programmer. The STLINK/V2-1 USB driver can be downloaded as STSW-LINK009. The X-NUCLEO-IDS01A4 (or X-NUCLEO-IDS01A5) expansion board connects easily to the STM32 Nucleo-144 board's Arduino connector.
Figure 10. STM32 Nucleo-144 plus the sub-1GHz expansion board description: This illustration shows the physical connection of the sub-1GHz expansion board (X-NUCLEO-IDS01A4 or X-NUCLEO-IDS01A5) to the STM32 Nucleo-144 board via its Arduino connector.
Important: To prevent resource usage conflicts between the X-NUCLEO-IDS01A4 (or X-NUCLEO-IDS01A5) expansion board and the NUCLEO-F429ZI board, the following modifications are necessary:
- On the NUCLEO-F429ZI, move the 0 Ω resistor from position SB121 to position SB122.
- On the X-NUCLEO-IDS01A4 (or X-NUCLEO-IDS01A5), move the 0 Ω resistor from position R4 to position R7.
Figure 11. NUCLEO-F429ZI board (bottom view): resistor position changed description: The bottom view of the NUCLEO-F429ZI board indicates the specific location (SB121) where a 0-ohm resistor should be moved to position SB122 to prevent resource conflicts.
Figure 12. X-NUCLEO-IDS01A4 (or X-NUCLEO-IDS01A5) expansion board: resistor position changed description: The X-NUCLEO-IDS01A4 (or X-NUCLEO-IDS01A5) expansion board diagram shows the location (R4) where a 0-ohm resistor should be moved to position R7 to prevent resource conflicts.
References
Freely available at www.st.com:
- UM2100: "Getting started with FP-SNS-6LPNODE1 software for IoT sensor node connection to 6LoWPAN networks using sub-1GHz RF"
Revision History
Date | Version | Changes |
---|---|---|
21-Dec-2017 | 1 | Initial release. |
IMPORTANT NOTICE
STMicroelectronics NV and its subsidiaries ("ST") reserve the right to make changes, corrections, enhancements, modifications, and improvements to ST products and/or to this document at any time without notice. Purchasers should obtain the latest relevant information on ST products before placing orders. ST products are sold pursuant to ST's terms and conditions of sale in place at the time of order acknowledgement. Purchasers are solely responsible for the choice, selection, and use of ST products and ST assumes no liability for application assistance or the design of Purchasers' products. No license, express or implied, to any intellectual property right is granted by ST herein. Resale of ST products with provisions different from the information set forth herein shall void any warranty granted by ST for such product. ST and the ST logo are trademarks of ST. All other product or service names are the property of their respective owners. Information in this document supersedes and replaces information previously supplied in any prior versions of this document.
© 2017 STMicroelectronics. All rights reserved.