Enable i.Mx platform with ZigBee using serial interface

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Enable i.Mx platform with ZigBee using serial interface

1,453 Views
AlanCollins
Contributor V


You can generate demo applications from BeeKit wireless toolkit. These demo apps have a feature called ZTC (ZigBee Test Client), which is basically a Serial protocol that allows you to monitor and inject messages, in between ZigBee internal layers (AF, APS, ZDO, SS, NWK, MAC). If you enable ZTC, you can make the whole chip to become a "black box" interface. This means you can control ZigBee by serial commands (UART, USB-virtual COM, SPI and IIC are supported). Of course, you will need to understand the ZigBee API so you know how to create/join network, start a binding process, send data, etc...


Then, Freescale provides the TestTool sotfware included in the BeeKit toolkit installer. Basically, you download ZTC enabled firmware to MKW2x-USB dongle, then connect it to the PC / Linux so it will be recognized as COM port / TTY serial interface. The TestTool (works only on Windows) includes a command console for you to manually access to all the ZTC available commands at all layers of the protocol. Besides the command console, TestTool includes a scripting client so you can run your Python scripts for more exhaustive testing scenarios.  For Linux, you could use Python as resource to reproduce a similar solution.


Here is a quick example on how to open the serial port and send/receive ZTC commands using python. It works on both Linux and Windows.

import serial

import binascii

GetModeCmd = ('\x02\xA3\x02\x00\x00\xA1') #ZTC-GetMode.Request 02 A3 02 00 00 A1

GetModeRespLenght = 26

#Linux:

#zigbeeUSB = serial.Serial('/dev/ttyACM0')

#Windows

zigbeeUSB = serial.Serial('COM59')

zigbeeUSB.baudrate = 115200

zigbeeUSB.timeout = None # This is important to zigbeeUSB.read is blocking

  # until the number of bytes is received

print zigbeeUSB.portstr

print "GetMode request:"

print " ".join(hex(ord(n)) for n in GetModeCmd)

zigbeeUSB.write(GetModeCmd)

RxBuffer = zigbeeUSB.read(GetModeRespLenght)

print "GetMode response:"

print " ".join(hex(ord(n)) for n in RxBuffer)

zigbeeUSB.close()

Labels (1)
Tags (1)
0 Kudos
Reply
0 Replies