Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MeshConnect Getting Started

This example demonstrate the basic operation of MeshConnect including network instantiation and mesh multicast communication. At least two boards are required to demonstrate send and receive. Demonstration of hopping requires three or more boards.

⚠ WARNING ⚠: Change the radio parameters prior to running this example. *Default communication occurs in the 900MHz ISM band for use in North America. *This frequency may be restricted in other regions.

Hardware Requirements

  • Two or more Northern Mechatronics development board (NM180100EVB, NM18041x) or user designed boards with a NM1801xx target and an SWD port exposed
  • USB cable (for NMI development boards with DAPLink onboard) or Segger J-Link

Software Requirements

  • Microsoft Visual Studio Code
  • Software prerequisites (see our Getting Started guide for details)

Build the Application

For instructions on how to build this reference application and flash the binary to the NM1801XX, follow along step-by-step in the Getting Started guide.

Regional Settings

⚠ WARNING ⚠: In the file application_lrm.c, adjust the transmit power and frequency to ensure compliance with your local law. They are defined by lrm_radio_transmit_power_dbm and lrm_radio_frequency_hz respectively.

  • lrm_radio_set_cfg(lrm_context_handle, LRM_RADIO_CFG_TX_POWER, lrm_radio_transmit_power_dbm);
  • lrm_radio_set_cfg(lrm_context_handle, LRM_RADIO_CFG_FREQUENCY, lrm_radio_frequency_hz);

Quick Start

The application is designed to automatically instantiate a network (if no existing network is found) or join an existing network out of the box. Once LED0 stops breathing and starts to blink, the device is ready for communication. The green LED LORA_TX indicates there is a transmit.

A short press of button BTN_0 will initiate a send. Upon receive, LED0 on the receiving device will blink solid for a second to indicate that a packet has been received.

mc_board.png

If the device is connected to a terminal, the payload of the received packet will be printed.

mc_cli_receive.png

MeshConnect Description

Protocol Stack API

The application firmware interacts with the MeshConnect protocol stack (OSI layer 1 to 3) with the API defined in lrm_api.h located in nmsdk2/targets/nm1801xx/common/lora_mesh/include.

lrm_task implemented in lrm_task.c handles all the transport layer (OSI layer 4) operations and application layer callback execution.

MeshConnect Setup

Network and radio setup are implemented in application_lrm.c. There are three steps to initialize MeshConnect:

  1. Define the network configuration.
  2. Configure the radio physical parameters.
  3. Configure the communication socket parameters.

Step 1: Configure the MeshConnect Network

For ease of demonstration, the application hardcodes all the parameters needed to allow devices to immediately start and join a network when powered on. These parameters are defined in the lrm_config structure.

As detailed in the lrm_network_configure function, the parameters used in this application are defined from line 46 to 52 of application_lrm.c.

mc_network_parameters.png

In a production application, the network parameters should reside in the secured memory region of the NM1801xx. These parameters can be programmed either at manufacturing or over BLE at the time of deployment.

Step 2: Configure the Radio

Radio parameters are defined from line 54 to line 57 of application_lrm.c. Adjust the parameters to comply with local laws.

mc_radio_parameters.png

Step 3: UDP Muticast Setup

Finally, adjust the socket bind address which is the sent address that a node should be listening to. In this example, :: is used meaning that it will respond to packets sent from any addresses within the mesh network.

The send socket address defined by udp_send_socket_address specifies the type of devices a multicast transmission is being sent to. The prefix ff03 is one of the reserved multicast addresses defined in RFC 4291 and specifies a mesh-local interface that includes all devices within the network as specified by RFC 7346 Realm-Local Scope.

Since layer 2 and 3 of MeshConnect follows IEEE 802.15.4, this prefix include all interfaces sharing the same Personal Area Network Identifier (PAN ID).

See MeshConnect Getting Started Guide for more details.

mc_socket_parameters.png

Command Line Interfaces

This application includes a command line interface (CLI) over VCOM or RTT for the user to directly control MeshConnect communications.

Connect the EVB or the Petal Development Board to the host computer via serial terminal to access the CLI. For a list of supported commands and usage, type help at the command prompt.

mc_cli_help.png

Two sets of commands were implemented: lrm and mc. lrm commands expose lower layer control and query of the MeshConnect stack. It is meant for diagnostics purposes. mc commands provide application layer interaction.

mc_cli_app.png

Two mc subcommands were implemented. They are mc periodic and mc send. mc periodic allows a user to periodically transmit an incrementing counter formatted in string.

mc_cli_periodic.png

mc send allows the user to send text or binary string.

mc_cli_send.png

MeshConnect Session Context

The MeshConnect stack uses the on-chip flash to store the session context. By default, two pages are used from the 4th last page of the flash region. Please reach out to Northern Mechatronics if customisation is required.

⚠ WARNING ⚠: For applications that make use of all radio access technologies simultaneously (BLE, LoRaWAN, MeshConnect), adjust the addresses of the session context of BLE and LoRaWAN to ensure no address collisions occur between the different protocol stacks. All BLE, LoRaWAN, and MeshConnect reference applications had the default session context addresses defined at different offsets to avoid collisions.

MeshConnect Hardware Timer Usage

In addition to the OS timers (STIMER A and B), MeshConnect uses the following Ctimers for network stack time keeping.

CTimer Clock Source Unit (ms / tick) Description
A7 AM_HAL_CTIMER_XT_DIV32 1 source for the protocol stack's 64-bit monotonic clock tick
A6 AM_HAL_CTIMER_XT_DIV32 1 32-bit event alarm tick

About

IPv6 Mesh over LoRa Phy

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages