Freescale Semiconductor
Technical Information Center, CH370
1300 N. Alma School Road
Chandler, Arizona 85224
+1-800-521-6274 or +1-480-768-2130
support@freescale.com
Freescale Semiconductor Japan Ltd.
Headquarters
ARCO Tower 15F
1-8-1, Shimo-Meguro, Meguro-ku,
Tokyo 153-0064, Japan
0120 191014 or +81 3 5437 9125
support.japan@freescale.com
Asia/Pacific:
Freescale Semiconductor Hong Kong Ltd.
Technical Information Center
2 Dai King Street
Tai Po Industrial Estate
Tai Po, N.T., Hong Kong
+800 2666 8080
support.asia@freescale.com
For Literature Requests Only:
Freescale Semiconductor Literature Distribution Center
P.O. Box 5405
Denver, Colorado 80217
1-800-521-6274 or 303-675-2140
Fax: 303-675-2150
LDCForFreescaleSemiconductor@hibbertgroup.com
Information in this document is provided solely to enable system and software implementers to use
Freescale Semiconductor products. There are no express or implied copyright licenses granted
hereunder to design or fabricate any integrated circuits or integrated circuits based on the information
in this document.
Freescale Semiconductor reserves the right to make changes without further notice to any products
herein. Freescale Semiconductor makes no warranty, representation or guarantee regarding the
suitability of its products for any particular purpose, nor does Freescale Semiconductor assume any
liability arising out of the application or use of any product or circuit, and specifically disclaims any
and all liability, including without limitation consequential or incidental damages. “Typical” parameters
that may be provided in Freescale Semiconductor data sheets and/or specifications can and do vary
in different applications and actual performance may vary over time. All operating parameters,
including “Typicals”, must be validated for each customer application by customer’s technical
experts. Freescale Semiconductor does not convey any license under its patent rights nor the rights
of others. Freescale Semiconductor products are not designed, intended, or authorized for use as
components in systems intended for surgical implant into the body, or other applications intended to
support or sustain life, or for any other application in which the failure of the Freescale Semiconductor
product could create a situation where personal injury or death may occur. Should Buyer purchase
or use Freescale Semiconductor products for any such unintended or unauthorized application,
Buyer shall indemnify and hold Freescale Semiconductor and its officers, employees, subsidiaries,
affiliates, and distributors harmless against all claims, costs, damages, and expenses, and
reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death
associated with such unintended or unauthorized use, even if such claim alleges that Freescale
Semiconductor was negligent regarding the design or manufacture of the part.
IAR Systems, IAR Embedded Workbench, C-SPY, visualSTATE, From Idea to Target, IAR KickStart
Kit, IAR PowerPac, IAR YellowSuite, and IAR are trademarks or registered trademarks owned by IAR
Systems AB.
ARM is the registered trademark of ARM Limited. ARM7TDMI-S is the trademark of ARM Limited.
Freescale™ and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other
product or service names are the property of their respective owners.
This guide provides a detailed description of the MC1322x Simple Media Access Controller (MC1322x
SMAC) demonstration applications. The demonstration applications are delivered as ANSI C source code
and are included in the MC1322x SMAC Codebase. The Codebase is incorporated into the Freescale
BeeKit Wireless Connectivity Toolkit. See the BeeKit Wireless Connectivity Toolkit User’s Guide
(BKWCTKUG) and the BeeKit on-line help for more information.
This guide explains how to run various MC1322x SMAC demonstration applications and provides
information that allows users to more easily take advantage of these demonstration applications or modify
the applications to fit their specific needs.
The demonstration applications shown in this guide are compatible with previous SMAC demonstrations
at the protocol level. However, the applications that employ security will be different because the
MC1322x SMAC takes advantage of the Advanced Security Module (ASM, AES based) security module
included in the MC122x Platform in a Package (PiP). The MC1322x device provides a more robust
security approach. For more information about security and the MC1322x, see the appropriate MC1322x
documentation available at www.freescale.com/zigbee.
The MC1322x SMAC API is similar to previous SMAC APIs. For more detail about the APIs, see the
MC1322x Simple Media Access Controller (SMAC) Reference Manual (22xSMACRM).
Available Devices
The MC1322x family is available as two part numbers. These device types differ only in their ROM
contents, all other device hardware, performance, and specifications are identical:
•MC13224V - this is the original version and is the generic part type.
— The MC13224V is intended for most IEEE 802.15.4 applications including MAC-based,
ZigBee-2007 Profile 1, and ZigBee RF4CE targets.
— It has a more complete set of peripheral drivers in ROM.
•MC13226V - this is a more recent version and is provided specifically for ZigBee-2007 Profile 2
(Pro) applications. Only the onboard ROM image has been changed to optimize ROM usage for
the ZigBee Pro profile and maximize the amount of available RAM for application use.
— The IEEE MAC/PHY functionality has been streamlined to include only that functionality
required by the ZigBee specification. The MAC functionality is 802.15.4 compatible.
— For a typical application, up to 20 kbytes more of RAM is available versus the M13224V
— Some drivers present in the MC13224 ROM have been removed and these include the ADC,
LCDfont, and SSI drivers. These drivers are still available as library functions, but now
compile into the RAM space.
— The Low Level Component (LLC) functionality has also been streamlined for the ZigBee
specification
NOTE
•When running the Freescale IEEE 802.15.4 MAC (or a related stack) on
the MC1322x platform, neither beaconing or GTS are supported.
•See the MC1322x Reference Manual (Document No MC1322xRM), for
information on using applications on these devices.
Audience
This document is intended for application developers generating MC1322x SMAC demonstration
applications from the Freescale BeeKit Wireless Connectivity Toolkit or modifying these applications as
a starting point for proprietary applications.
Organization
This document is organized into ten chapters.
Chapter 1Introduction — This chapter shows how to generate an SMAC demonstration
application using BeeKit.
Chapter 2Wireless UART — Provides a detailed description of MC1322x SMAC Wireless
UART demonstration application.
Chapter 3Connectivity Test — Provides an easy way to test the RF performance of the
transceiver for basic transmitter and receiver tests. It includes test mode
(continuous tx, modulated, unmodulated, etc.); Packet Error Rate and Range (LQI
measurements).
Chapter 4Accelerometer Test — Provides an overview of the Accelerometer
Demonstration application, which shows various uses for the Freescale X, Y, and
Z axes accelerometers.
Chapter 5Low Power Bell — Shows how to implement different low power options.
Chapter 6Generic Application — Provides a start template for users what want to add their
own application.
Chapter 7Simple ZTC — Allows users to test the SMAC primitives by sending special data
frames through the Serial/USB port.
Chapter 8Repeater— Implements a simple repeater which extends the range between two
boards running an SMAC application demonstration.
Chapter 9Weather Station— Simulates a Weather Station and shows the use of Freescale
sensors for acceleration and pressure.
Chapter 10Over The Air Programmer (OTAP) — Allows users to update a board’s FLASH
remotely without a physical connection. Given an OTAP enabled application and
an OTAP programmer, users can replace an existing application with a new
application.
S19S - Record. 'S19' is the file extension used for the Freescale binary image format.
The S19 file encapsulates the binary image as a list of ASCII records. Each record
contains a length -, address -, data - and checksum field. The 16 bit address field
allows a memory space for up to 64 KB. The S19 can be generated with
CodeWarrior IDE and is the product from the linking process. S19 does not
contain additional information to a debugger (where to look for source files).
Safe Mode BootThe Embedded Bootloader boots up using safe default system values.
SMACSimple Media Access Control.
SNSensor Node Evaluation Board.
TXTransmission.
References
The following sources were referenced to produce this book:
Chapter 1
Generating an SMAC Application and Port Configuration
This chapter provides an overview of how to generate an SMAC demonstration application using BeeKit.
This chapter only provides an overview of how to generate an SMAC demonstration application. For more
details on installing BeeKit and BeeKit operation, see the BeeKit Wireless Connectivity Toolkit User’s Guide (BKWCTKUG).
This chapter also shows how to set up a virtual UART/USB COM port. Once the ports are configured, refer
to the appropriate application chapter in this guide.
1. Install and then launch BeeKit and the BeeKit main window appears as shown in Figure 1-1.
Figure 1-1. BeeKit Graphical User Interface
2. Select the SMAC Codebase as shown in Figure 1-2.
Generating an SMAC Application and Port Configuration
Figure 1-2. selecting SMAC Codebase
In BeeKit, a Codebase is a set of files and rules that permit users to generate the final applications. This
step is important, because the SMAC Codebase is different than the Codebase of MAC and BeeStack.
Generating an SMAC Application and Port Configuration
Figure 1-3. Creating a new project
If users create a new project and there is not a an existing solution, then users are also creating a solution.
The solution must have a name. Specify a name for the solution.
4. Add other required projects for the evaluation as shown in Figure 1-4.
Figure 1-4. Adding a New Project to a Existing Solution
OTAP mode when this OTAP Request Code is received.
OTAP Programmer.
Generating an SMAC Application and Port Configuration
6. Users must now validate the solution as shown in Figure 1-5. The validation process helps users
find possible inconsistencies between the selected hardware and properties.
Figure 1-5. Validating a Solution
7. Users must now export the solution as shown in Figure 1-6.
Generating an SMAC Application and Port Configuration
1.1Loading Applications Into a Board Using the JTAG J-Link ARM
Debugger
After exporting from BeeKit, the projects are generated as a .eww file. Perform the following tasks to load
the application to a board, using the IAR Embedded Workbench IDE. This example uses the repeater
application.
1. As shown in Figure 1-7, open the My Solution.eww file.
Figure 1-7. Opening a project
2. Make the project by clicking the Make button (Figure 1-8) which is located at the top of the IAR
Embedded Workbench main Window as shown in Figure 1-9.
Figure 1-8. Make Button
Figure 1-9. IAR Embedded Workbench Main Window
3. Connect the J-Link to the target board.
4. Click the Debug button Figure 1-10 which is located at the top of the IAR Embedded Workbench
main window as shown in Figure 1-9.
Generating an SMAC Application and Port Configuration
1.3UART/USB Virtual COM Port Setup
This section describes how to set up a virtual COM port for the following demonstration applications:
•Chapter 2, “Wireless UART Demonstration”
•Chapter 3, “Connectivity Test”
•Chapter 6, “Generic Application Demonstration”
•Chapter 7, “Simple ZigBee Test Client (SZTC) Demonstration”
•Chapter 8, “Repeater Demonstration”
•Chapter 9, “Weather Station Demonstration”
•Chapter 10, “Over The Air Programmer Demonstration”
Attach two boards to two PCs. This allows communication using a PC terminal communications program.
The two boards can be attached to two different serial ports of the same PC if needed, but Freescale
recommends using two PCs when possible.
1. Connect each of the boards to a separate PC either with an RS-232 cable or a USB cable. If using
a USB cable, a corresponding USB driver is required. Freescale recommends a direct USB
connection. Do not use a USB hub. This driver is located in the following directory:
<INSTALL DIR>\Freescale\Drivers
The BeeKit CD image is available from the Freescale ZigBee web site at
www.freescale.com/zigbee.
2. To check which COM port is being used by the USB, do the following:
a) Open the Windows System Properties window using Start->Settings->Control Panel->System.
b) Select the Hardware tab, and click the Device Manager button. The Device Manager window
appears as shown in Figure 1-16.
Figure 1-16. COM Port Determination in Device Manager
The Wireless UART application allows the Freescale ZigBee family of boards to communicate at
typematic rates from one board to another over RS-232 cables or USB virtual COM ports. In order to
execute this demonstration application the user will need a tool to send and receive characters over two
serial ports in addition to what Freescale supply.
This chapter provides a simplified example. Currently, the code cannot be used as a cable replacement. If
cable replacement is the ultimate goal, then queues, buffers, and other constructs must be added to increase
the reliability and efficiency of this demonstration.
Prior to loading the Wireless UART application, the application must be generated using BeeKit, as
described in the BeeKit Wireless Connectivity Toolkit User’s Guide.
The MC1322x SMAC Wireless UART demonstration application is protocol compatible with previous
SMAC Wireless UART applications (those that run on the MC1319x, MC1320x, and MC1321x boards).
However, if security is enabled, the MC1322x SMAC Wireless UART demonstration application is
incompatible with previous SMAC versions.
See Section 1.3, “UART/USB Virtual COM Port Setup” for information about how to set up a virtual COM
port for this application.
2.1Generating a Project From BeeKit
Once the UART/USB virtual ports have been configured, continue with generating the project from
BeeKit as follows.
1. Open BeeKit (Start->Programs->Freescale BeeKit->Freescale BeeKit).
2. In BeeKit, select the MC1322x SMAC codebase (File menu -> Select Codebase...)
3. Click on File -> New Project and choose the Wireless UART template.
4. Follow the steps as displayed in the New Project wizard.
5. Configure the properties as needed.
6. Validate the solution.
7. Export the solution.
8. BeeKit creates the project folder with the structure as shown in Figure 2-1.
The WirelessUART.bin file is placed at the following directory location:
[Project Directory]\Release\Exe\
4. Load the WirelessUART application to the boards. Connect the JTAG interface to the board, then
click the Debug button on the IAR Embedded Workbench IDE.
5. Use a PC terminal communications program, such as Hyper Terminal, and set the correct baud rate,
data bits, parity, COM port, and flow control. Figure 2-4 shows the default MC1322x SMAC
RS-232 settings.
6. In the PC terminal program, set the properties in the optional settings as shown in Figure 2-5.
Figure 2-5. Additional Terminal Program Settings
7. Start the serial communication software and send any characters using the keyboard. The other
board answers with the “Wireless Typematic Demo.“ message as shown in Figure 2-6.
8. Type some characters in the Hyper Terminal Session (Board 1, shown in Figure 2-7) and the typed
message appears on the other PC Hyper Terminal Session (Board 2, also shown in Figure 2-7).
This is a two-way communication protocol where the boards will retry their packets up to three times if an
acknowledgement is not received. This application highlights a very basic MC1322x SMAC Wireless
UART implementation and as already stated, because it is a basic demonstration application, it is not
intended for large file transfers.
The connectivity test evaluates the basic connectivity between two transceivers. A transmitter and a
receiver application are required. The connectivity test supports the following functionality:
•Configure the transceiver in a specific test mode in order to test the transceiver RF performance.
These test mode are:
— Modulated Transmission
— Unmodulated Transmission
— Pulse PRBS Transmission
—IDLE
•Measure the percentage of packet losses over a certain channel as well as the Link Quality Indicator
of each packet received.
•Indicate the range of a signal using the Link Quality Indicator.
In both modes parameters such as the channel number and power level can be modified. This allows users
to execute all tests in every channel using different power values.
The application includes a reference oscillator frequency output at a pin useful for frequency measurement
and adjustment when required.
Two possible interfaces are implemented to use this application: a manual interface through push buttons
or menus for a serial interface. Only one interface can be selected, both interfaces can not been working at
the same time. The interface type is selected when creating the project with the Freescale BeeKit.
For manual interface, the function of each button is as follows:
•SW1: Selects the application mode. (Channel Change, Power Adjust, Test to perform, etc.) see
Figure 3-1.
•SW2: Increases a value.
— For TX the possible options are: IDLE (0), PSRB (1), PER (2), Range Test TX (3), Continuous
Modulated (4) and Continuous Unmodulated (5).
— For RX mode the possible options are: IDLE (0), Continuous reception (1), PER(2) and Range
Test RX (3).
— The values are momentarily shown at the LEDs then LEDs show current application mode.