Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartMesh IP in Zephyr

This Zephyr application runs on an application chip, which connects via UART to a networking chip (LTC 5800). As application chip, any MCU supported by Zephyr can be chosen. In the following example, we use the MAX78000. The MAX78000 connects via UART to a SmartMesh IP mote, which then connects to a SmartMesh IP manager.

Tested with:

  • Zephyr Version 4.0.99
  • Zephyr SDK Version 0.17.0
  • CMake Version 3.29.3

Clone

cd C:\...\git

git clone --recurse-submodules https://github.com/fabiangraf96/sm_zephyr.git

Build

cd C:\...\zephyrproject

.venv\Scripts\activate

west build -p always ^
           -b max78000fthr/max78000/m4 ^
           -s C:/.../git/mobility_poc_firmware ^
           -d C:/.../git/mobility_poc_firmware/build/max78000

Flash

The MAX78000 FTHR Board has integrated CMSIS DAP Debugger:

C:\...\MaximSDK\Tools\OpenOCD\openocd.exe ^
  -s C:\...\MaximSDK\Tools\OpenOCD\scripts ^
  -f interface/cmsis-dap.cfg ^
  -f target/max78000.cfg ^
  -c "init" ^
  -c "reset init" ^
  -c "flash write_image erase C:/.../mobility_poc_firmware/build/max78000/zephyr/zephyr.hex" ^
  -c "reset run" ^
  -c "shutdown"

Alternatively, a J-Link Debugger can be used. Open J-Link.exe and execute:

J-Link> connect
Device> MAX78000
TIF> SWD
Speed> 4000 kHz

J-Link>loadfile C:\...\mobility_poc_firmware\build_max78000\zephyr\zephyr.elf

J-Link>r

Prerequisites

Software

Hardware Setup

MAX78000 FTHR Board + SmartMesh IP Mote (DC9003A-B)

Prepare SmartMesh IP Mote in HW Setup 1

To set set SmartMesh IP Mote (DC9003A-B) into slave mode, connect to the programmer and connect to its serial CLI and issue the following command:

set mode slave

SmartMesh IP Manager

There are 2 different versions of the SmartMesh IP manager:

DC2274 AIOT Gateway

See the mote join via the manager CLI

When connecting the manager as USB device, 4 COM-Ports appear in ascending order. The third one corresponds to the serial manager CLI. The show mote command allows to see all motes (including manager) in the network:

sm

See the incoming messages via the manager API

The JsonServer is a command-line tool that turns the SmartMesh IP Manager serial API into an JSON-based HTTP API. It is publicly available on Github: https://github.com/dustcloud/smartmeshsdk/tree/master/app/JsonServer For more details, refer to: https://dustcloud.atlassian.net/wiki/spaces/SMSDK/pages/95125618/JsonServer First clone the Smart Mesh SDK (SMSDK) repository from Github, then start the JSonServer.

cd C:\...\git
git clone https://github.com/dustcloud/smartmeshsdk
cd smartmeshsdk3
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python ​app\JsonServer\JsonServer.py

Issue the show ports sp command to list the COM-Ports related to the SmartMesh IP manager. Then connect the JSonServer to the manager's serial API (thourth COM-Port in Windows) by using the connect manager cm command. Verify, if you are connected by using the s command.

JsonServer - (c) Analog Devices, Dust Networks products
  running versions:
    - SmartMesh SDK: 1.4.0.1
> sp
{   'serialports': [   'COM7',
                       'COM12',
                       'COM13',
                       'COM14',
                       'COM15']}
> cm COM15
> s
{   'SmartMesh SDK version': '1.4.0.1',
    'current time': '06/02/2023 11:06:48',
    'managers': {'COM15': 'connected'},
    'running since': '06/02/2025 11:06:27 (0:00:21.193483 ago)',
    'threads running': [   'MainThread',
                           'SnapshotThread',
                           'ManagerHandler@COM15',
                           'DustCli',
                           'WebServer',
                           'COM15_HDLC',
                           'IpMgrSubscribe']}

The HTTP API can be accessed for instance with Node-RED. Node-RED is a flow-based programming tool for wiring together hardware devices, APIs and online services. Node-RED can be either be installed via node-js: https://nodejs.org/en by using the Node Package Manager (npm):

npm install -g --unsafe-perm node-red

Then start Node-RED at port 1880 by typing:

node-red

Alternatively, Node-RED can be run as a Docker container via the command:

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red

When opening http://127.0.0.1:1880/ one can create flows and observe the corresponding incoming messages from the JSonServer:

  1. Create a flow based on an "http in"-node. Choose the POST method and "/notifData" as URL.
  2. Create a flow based on an "http in"-node. Choose the POST method and "/event" as URL.
  3. The debug output of the event node shows the joining process of the mote.
  4. The debug output of the notifData node shows the data transmitted from the mote to the manager.

License and Copyright

The project is under BSD-3 License (https://spdx.org/licenses/BSD-3-Clause-Clear.html).

Copyrights and Sources are stated in the Comment Header of each file.

Collection of used sources in this project:

Code Source Owner URL
sm_qsl Dust Networks https://github.com/dustcloud/QSL-for-sm_clib
sm_clib Dust Networks https://github.com/dustcloud/sm_clib

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages