...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Necessary Hardware
- Microcontroller/development board of your choice
- With necessary programmer
- SmartMesh IP Mote (DC9003A-B)
- With 6 female-female jumper cables
- SmartMesh IP Manager (DC2274A-A)
- SmartMesh Interface Board (DC9006A)
- With USB-A to USB-micro cable
- Computer (should support Python and Java)
...
Necessary Software
- FTDI Serial Drivers
- IDE/programmer/debugger of your choice
- SmartMesh C Library
- SmartMesh QuickStart Library
- Git client (optional)
2 Prepare Libraries
2.1 About
The SmartMesh QSL abstracts the complexity of the SmartMesh IP mote startup and network search/join procedure into a few intuitive functions. It utilizes the SmartMesh C Library, which provides a full implementation of the serial API of the SmartMesh IP mote.
While the QSL provides sufficient functionality for sending/receiving data and configuring the most important network settings on a SmartMesh IP mote, more advanced applications that need access to all parameters should access the mote serial API directly.
2.2 Download
Downloading Libraries
There are two ways to download the QuickStart Library:
...
- Clone the repository: TODO: Add link when public repo created
- Checkout the latest release: TODO: Refer to latest release
Initialize and update the neccessary C Library submodule:
(...)
/QuickStart_Library
$ git submodule init
(...)
/QuickStart_Library
$ git submodule update
Download Zip/Tar
- Go to the QSL release page and download the latest zip/tar: TODO: Add link when public repo created
- Go to the C Library release page and download the latest zip/tar: TODO: Can possibly be added as attachment to QSL release. If not: Make a note about why it needs to be downloaded separately
- Unzip the files using your favourite compression tool.
...
Directory Structure
The QSL repository contains the following directories:
...
In addition to the files in these folders, you need to implement a handful of functions, as discussed in the next section.
...
Port to Your Hardware
The QSL and the underlying C Library are written to be used as-is in any C-based platform; however, you have to implement a handful of functions to adapt them to a specific platform. These functions are implemented in the example code provided for certain platforms (presented in later chapters), so you can skip the details of this section for now if you plan on using these (or simply wish to have a look at the examples first).
...
- dn_uart.h: These functions allow the SmartMesh C Library to send bytes over the serial port, and receive bytes from the serial port. A "flush" function is provided in case the serial (UART) driver of the user platform is frame-oriented rather than byte-oriented.
- dn_lock.h: These functions allow the SmartMesh C Library to operate in a multi-threaded environment. If this is the case in the user system, the implementation of these functions would typically consist of pending/posting a mutual exclusion semaphore (mutex); if not, simply use stub functions (i.e. "empty functions").
- dn_endianness.h: These functions are used to match multi-byte API fields (which are big-endian) to the endianness of the platform.
- dn_time.h: These functions allows the QSL to perform timing and schedule tasks.
- dn_watchdog.h: These functions allow the QSL to make sure any watchdog in the user application is fed during processes that can take some time (e.g. searching for a network). If no watchdog is present, simply use stub functions.
...
The QSL is currently meant to be run in a single threaded environment, thus you can just use stub functions for the prototypes in dn_lock.h. If you wish to run the QSL in a multi-threaded environment, you should create your own mutex (separate from the prototypes in dn_lock.h) to be locked/unlocked before/after calls to the QSL API.
Expand |
---|
...
|
...
| ||||||||||||||||
|
3 Install FTDI Serial Drivers
...
The ports of interest are the third and fourth, which map to the CLI and API, respectively, as defined by Table 1.
Device | Serial Port Number | Usage | Baudrate | Data Bits | Parity | Stop Bits |
---|---|---|---|---|---|---|
SmartMesh IP Manager | third* | CLI | 9600 | 8 | No | 1 |
fourth* | API | 115200** | 8** | No** | 1** | |
SmartMesh IP Mote | third* | CLI | 9600 | 8 | No | 1 |
fourth* | API | 115200** | 8** | No** | 1** |
...
- Start by connecting the mote to your computer via the interface board, as shown in Figure 1.
- Identify the port name that maps to the CLI. For example, if you are in Windows and see the four COM ports pictured below, the CLI will be accessible through COM14.
- Connect to the mote CLI with a third-party serial terminal of your choice (e.g. putty). See Table 1 for configuration details.
Use the get mode command to see the current mode:
> get mode
master
Use the set mode command to switch to slave mode, followed by reset for the change to take effect. After rebooting, a new get mode should confirm the persistent mode change.
> set mode slave
> reset
> SmartMesh IP mote, ver 1.3.3.1 (0x100)
> get mode
slave
- Disconnect the mote from the interface board and make sure to remove its battery (if any), as we will power the mote from the MCU.
...
Table 3 lists the names (equal to those found on the silkscreen) of the P1 pin header on the DC9003A mote board visible in Figure 2.
MCU | Mote |
---|---|
3.3 V | VBAT |
Ground | GND |
UART TX | RX |
UART RX | TX |
Name | Pin # | Name | |
---|---|---|---|
TX CTSn | 1 | 2 | TX RTSn |
TX | 3 | 4 | GND |
RX | 5 | 6 | RX RTSn |
RX CTSn | 7 | 8 | CO TX |
CO RX | 9 | 10 | GND |
RESETn | 11 | 12 | F P ENn |
I MISO | 13 | 14 | I MOSI |
I SSn | 15 | 16 | I SCK |
GND | 17 | 18 | TCK |
TMS | 19 | 20 | TDO |
TDI | 21 | 22 | VUSB_3V6 |
PGOOD | 23 | 24 | GND |
VBAT | 25 | 26 | KEY |
EHORBAT | 27 | 28 | RSVD |
I/O 1 | 29 | 30 | I/O 2 |
V+ | 31 | 32 | +5V |
...
By default the manager is shipped with a well-known network ID and join key that your application will need to connect to its network, so you do not need to configure anything. However, it is useful to know about certain commands available through the CLI. These commands are presented in the next section, while relevant default values for its configuration parameters are listed in Table 4.
Parameter | Comment | Default Value |
---|---|---|
netid | Network ID | 1229 |
commjoinkey | Common Join Key (hex) | 44 55 53 54 4E 45 54 57 4F 52 4B 53 52 4F 43 4B |
basebw | Base bandwidth, i.e. period between packets [ms] | 9000 |
...
- Just like with the mote, identify the correct serial port name and connect to the CLI with a serial terminal of your choice (again, see Table 1 for configuration details).
Unlike the mote, you will first have to login to have access to the commands we want:
login> login user
- You now have access to a wide range of commands, where the most interesting ones are shown below.