Wireless Kit Uses 6LoPAN for Sensor Networks

DN Staff

June 7, 2011

6 Min Read
Wireless Kit Uses 6LoPAN for Sensor Networks

This kit provides away to evaluate the ZMDI ZWIR4512 low-power wireless IPv6 modules that simplifythe creation of products that can exchange secure User Datagram Protocol (UDP)messages in the 886 and 915 MHz bands available in the U.S. and Europe. Modulestake advantage of the "IPv6over Low power Wireless Personal Area Networks," or 6LoPAN, stack thatoperates with IEEE 802.15.4 radios. This explanation might sound complicated,but rest easy; the modules simplify communications to the level of standardUART-based communications and API-based C code.

The kit includes three boards, each with a ZWIR4512A modulesoldered in place and a screw-on antenna (supplied). Modules can communicatewith a PC via a USB port. Traces on each board route signals from the 30-pinSMT transceiver module to headers that give you easy access to analog anddigital I/O pins. The three modules arrived with a pre-programmed demonstration,but before I made any connections I printed the "Getting StartedGuide" (GSG) on the included CD-ROM. I found minimal instructions abouthow to run the demo at the end of the guide. They should appear earlier on.These instructions recommend using HyperTerminal or another terminal emulatorto communicate between computers. It took only a few minutes to establishwireless communications between two computers via HyperTerminal.

Wireless Kit Uses 6LoPAN for Sensor Networks

Wireless Kit Uses 6LoPAN for Sensor Networks


Programming the ZWIR4512 modules requires the Rowley Assoc.CrossWorks integrated development environment, and the GSG explains how todownload and install the software and obtain a free 30-day license for theSTMicroelectronics ARM Cortex-M3 processor within each module. Rowley respondedquickly to my e-mail request for a license. The ZMDI instructions about how toset up the CrossWorks software took extra time to understand because ofstatements such as, "the ZWIR4512 library can be installed like the boardsupport package by double clicking." I figured out how to find the driversand install them. The people at ZMDI assured me they will include more setupinformation in the next GSG.

After describing how to set up the Rowley tools, the GSG instructionsexplained how to rebuild the demo code and download it to the boards. Thatprocess went smoothly. Every five seconds the demo displays the 16-byte addressof a transmitting module (a "blink" message) on a PC connected toeach module. You also can type information, press ENTER, and see your"message" appear on the other computers, too. I decided to modify thecode to remove the blink message and use only back-and-forth typed messages.The demo code was easy to understand and well-documented, so it didn't takelong to eliminate the blink-message sections and exchange only typed messages.

ZMDI uses an application programming interface (API) thateliminates the need to program control bits or registers in each module andthus simplifies programming. The CD-ROM includes a well-organized 67-pageProgramming Guide that clearly explains how the modules operate, API namingconventions, and how to use the API library of 139 functions. Each API entryincludes a good description.

The radio modules use a built-in basic operating system thathandles events in a preset priority, so you use the API to create sections ofcode for events or commands rather than use polling and low-level hardwarecoding. The OS handles only one thread at a time, so you must write what ZMDIcalls "cooperative code." After creating a program written with theAPI, you build it with the Rowley CrossWorks IDE, and download it to eachmodule.

The IPv6 standard includes the IP Security (IPSec) protocol forcommunication security that authenticates and encrypts each IP packet. IPSecalso lets devices authenticate each other and negotiate distribution ofcryptographic keys. The ZMDI API library includes security functions that letyou implement the IPSec operations and an IKEv2 library for management ofcryptography keys. I did not investigate these capabilities.

Sometime soon designers can control modules via Command Interfacefirmware, but ZMDI hadn't completed work on this technique at review time. Iplan to explore that type of operation as soon as the company makes itavailable and provides a manual.

ZMDI supplies the demo program and an Ethernet-gateway program,but so far you have no other code to learn from or study. Additional exampleswould improve the kit, as would several flow charts that show how to initializeand set up a module for a variety of applications. The company has suchinformation for another module so perhaps it will provide more details for theZWIR4512 modules soon.

Although the ZWIR4512 modules provide analog and digital I/Opins, ZMDI has not yet documented high-level functions that let designers usethem. One of my contacts at the company provided examples that show how tocontrol a digital I/O pin via the "STM32 Standard PeripheralLibrary," the "Cortex Microcontroller Software Interface Standard" (CMSIS), or the "ZWIR45x1x-GPIO" library. The latter willcontrol only digital I/O signals, but ZMDI has not yet released it. Iused the CMSIS method, set the PA5 pin as an output, and toggled it. You can findexplanations of the commands in the stm32f10x.h file included with the Rowleysoftware. Thanks go to Torsten Limberg at ZMDI for the sample code and guidanceabout how to control the I/O pins.

Here is the CMSIS code to control output PA5:

#include "ZWIR45xx-6LoWPAN.h"

// include STM32 CMSISheader - this defines types and
//structures for accessing the STM32 peripherals
// conveniently

#include

// configure GPIO port Aafter module-hardware reset

void ZWIR_AppInitHardware(ZWIR_ResetReason_t resetReason)
{
// set all bits of GPIO PA5 configuration to0
GPIOA -> CRL &= ~ (0xf << 20);
// configure GPIO PA5 pin as an output
GPIOA -> CRL |= 1 << 20;
}

// toggle PA5 output witha 1-sec period
void ZWIR_Main1000ms(void)
{
// toggle GPIO5
GPIOA -> ODR ^= 1 << 5;
}

My scope showed a change on the PA5pin every second.

If you plan to use the I/O pins via the functions given in thestm32f10x.h file, you also should download the STMicroelectronics document,"RM0008 Reference Manual" for the STM32F101xx, STM32F102xx,STM32F103xx, STM32F105xx and STM32F107xx advanced ARM-based 32-bit MCUs.Search the ST site for part number STM32F103RC, click on "designsupport," and look under the heading, "reference manuals."

The STM32F103RC MCU in the wireless modules provides I/O portsthat include digital inputs and outputs, analog inputs, SPI, USB, CAN and I2Cinterfaces, as well as two UARTs, so in many designs you might not need anexternal chip to control or monitor remote sensors. You could create a programthat would run in the ZMDI OS framework and wake up after a preset period orrespond to commands sent from a network controller. The forthcoming CommandInterface might provide additional I/O capabilities at remote sensor modules.

As of late May 2011, ZMDI has two U.S. distributors. One did nothave the kit in stock or in its product database. I left a message for thesecond distributor but hadn't received a call as I completed this description.

U.S. readers can call William Merz in the ZMDI office (Melville,NY) at: 631-549-2666 or send an e-mail to: [email protected] to connect with a kitseller. Or for general inquiries, send e-mail to: [email protected].

Sign up for the Design News Daily newsletter.

You May Also Like