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.
ARM is the registered trademark of ARM Limited. ARM7TDMI-S is the trademark of ARM Limited.
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.
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 description of the Freescale MC1322x Simple Media Access Controller (MC1322x
SMAC).
Audience
This document is intended for application developers building IEEE 802.15.4 PHY compliant wireless
applications.
The MC1322x SMAC is incorporated in the Freescale BeeKit Wireless Connectivity Toolkit. The
incorporation of the MC1322x SMAC into BeeKit makes it easier for users to employ and customize the
MC1322x SMAC and associated applications.
The MC1322x SMAC is not the same SMAC used for the MC1319x and MC1321x. The primary
differences are as follows:
•MC1322x SMAC does not have blocking functions
•MC1322x SMAC has a new Radio Management module which allows management of multiple
messages depending on the application needs
•MC1322x file and directory structure are different
•MC1322x API is different
Organization
This document is organized into three (3) chapters.
Chapter 1MC1322x SMAC Introduction — This chapter introduces the MC1322x SMAC
features and functionality.
Chapter 2MC1322x SMAC Software Architecture — This chapter describes the MC1322x
SMAC software architecture.
Chapter 3MC1322x SMAC Primitives — This chapter provides a detailed description of
MC1322x SMAC primitives.
Revision History
The following table summarizes revisions to this document since the previous release. (Rev 1.6)
Revision History
LocationRevision
Chapter 3Added new function
Freescale Semiconductoriii
MC1322x SMAC Reference Manual, Rev. 1.7
Definitions, Acronyms, and Abbreviations
The following list defines the acronyms and abbreviations used in this document.
AESAdvanced Encryption Standard
APIApplication Programming Interface
ASMAdvanced Security Module
BDM debuggerA debugger using the BDM interface for communication with the MCU. An
example is the P&E BDM Multilink debugger for HCS08
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 for a debugger (where to look for source files)
Safe Mode BootThe Embedded Bootloader boots up using safe default system values
SMACSimple Media Access Controller
ivFreescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
Chapter 1
MC1322x SMAC Introduction
The Freescale MC1322x Simple Media Access Controller (MC1322x SMAC) is a simple ANSI C based
code stack available as sample source code. The MC1322x SMAC can be used for developing proprietary
RF transceiver applications using the Freescale MC1322x Platform in a Package (PiP). The MC1322x
SMAC is designed to work with the MC1322x MCUs. See Section 1.1, “Available Devices” for more
information.
The MC1322x SMAC is incorporated in the Freescale BeeKit Wireless Connectivity Toolkit. The
incorporation of the MC1322x SMAC into BeeKit makes it easier for users to employ and customize the
MC1322x SMAC and associated applications, see the MC1322x SMAC Demonstration Applications User’s Guide (22xSMACDAUG) for more information on these applications.
To use any of the existing applications available in the MC1322x SMAC, users must first generate the
applications as projects in a BeeKit solution. For more information about BeeKit, BeeKit Projects, and
BeeKit Solutions, refer to the BeeKit Wireless Connectivity Toolkit User’s Guide (BKWCTKUG) and the
BeeKit on-line help.
The following is a list of MC1322x SMAC based demonstration applications:
•Wireless UART
•Connectivity
•Accelerometer
•Low Power Bell
•Generic Application
•Simple ZTC
•Repeater
•Weather Station
•OTAP Programmer
For more details on running the MC1322x SMAC demonstration applications, refer to the MC1322x SMAC Demonstration Applications User’s Guide. (22xSMACDAUG)
For more details about the MC1322x device, refer to the appropriate MC1322x Reference Manual
(MC1322xRM) and/or Data Sheet (MC1322x).
MC1322x SMAC Reference Manual, Rev. 1.7
Freescale Semiconductor1-1
MC1322x SMAC Introduction
1.1Available 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.
1.2Features
•Compact footprint:
— Read Only - Code: ~5 Kb
— Read Only - Data: ~0.5 Kb
— Read Write - Data: ~2.5 Kb
•No blocking functions. (A blocking function means that the calling function will not return until
the routine is complete. Non-blocking functions return immediately, allowing core processing to
occur concurrently. A callback mechanism is included with the non-blocking functions to allow
synchronization.)
•Very-low power, proprietary, bi-directional RF communication link
•ANSI C source code targeted for the MC1322x core
•Easy-to-use sample application included
•Support for AES128 security for the transmission/reception of secured data in the SMAC packets
1-2Freescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Introduction
1.3MCU Resource Requirements
The MCU requires an external reference clock with allowed values from 13 MHz to 26 MHz.
Besides the memory resources, the SMAC uses the MACA module and thus all radio portions of the
MC1322x device. Depending on the demonstration, other resources are used such as the ADC, KBI, GPIO,
Timers and others.
1.4Introducing BeeKit
The Freescale BeeKit Wireless Connectivity Toolkit is a comprehensive Codebase of wireless networking
libraries, application templates, and sample applications. The BeeKit Graphical User Interface (GUI), part
of the BeeKit Wireless Connectivity Toolkit, allows users to create, modify, and update various wireless
networking implementations.
The MC1322x SMAC is released in an independent Codebase that is part of the Freescale BeeKit Wireless
Connectivity Toolkit. To create a project for the MC1322x SMAC, users must employ the BeeKit
Codebase that contains the MC1322x SMAC code. For more information on BeeKit, refer to the BeeKit Wireless Connectivity Toolkit User’s Guide (BKWCTKUG).
For more information on the Codebase as it applies to MC1322x SMAC, refer to the MC1322x SMAC Demonstration Application User's Guide. (22xSMACDAUG)
1.4.1BeeKit Concepts
This section highlights some basic BeeKit terms and concepts. Again, for a more detailed description of
BeeKit, refer to the BeeKit Wireless Connectivity Toolkit User’s Guide (BKWCTKUG).
CodebaseA group of source files, configuration files, and generation rules that serve as a
repository from which all BeeKit demos, templates, and other applications are
generated.
SolutionA group of projects which are linked to a specific folder within the file structure
of the computer and in this file structure, all other projects will generate their own
folders.
BeeKit ProjectA specific group of files in a directory tree that BeeKit can export for the
developer. An XML Project File in the tree describes the content and organization
of the project..
XML Project FileA BeeKit generated XML file ready to import into CodeWarrior or IAR´s
Embedded Workbench IDE.
Figure 1-1 shows the folder structure of a typical project generated using MC1322x SMAC Codebase for
BeeKit.
Freescale Semiconductor1-3
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Introduction
Figure 1-1. Example Project Folder Structure
1-4Freescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
Chapter 2
MC1322x SMAC Software Architecture
This chapter describes the MC1322x SMAC software architecture. The MC1322x SMAC Codebase is
different than the S08 targeted SMAC Codebase. BeeKit can use the MC1322x SMAC codebase to create
projects to be compiled with the IAR Embedded Workbench IDE.
2.1MC1322x SMAC Block Diagram
The Freescale MC1322x is a Platform in a Package (PiP) which integrates an RF transceiver modem,
MCU, AES ciphering and is fully compliant with the IEEE 802.15.4 standard. The MC1322x SMAC uses
its advanced, integrated functionality to provide a simple and high performance software package for IEEE
802.15.4 PHY wireless connectivity.
Figure 2-1 shows the MC1322x SMAC block diagram and the various MC1322x SMAC software
components. It is important to note the optional MC1322x SMAC modules:
•Security Module
•Over The Air Programmer (OTAP) Module
Figure 2-1. MC1322x SMAC Block Diagram
Freescale Semiconductor2-1
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Software Architecture
Security, and OTAP modules and their APIs are included in the BeeKit project when the following
MC1322x SMAC BeeKit properties are set to True:
•Security Enabled
•OTAP Enabled
An API is implemented in the MC1322x SMAC as a C header file (.h) that allows access to the code. The
code includes the API to specific functions.
2.2Hardware Support
This section describes the MC1322x SMAC hardware support
The MC1322x SMAC only supports the Freescale MC1322x transceivers and the MC1322x SMAC
projects only support the following Freescale development boards:
•MC1322x Sensor Node (MC13224 and MC13226)
•MC1322x Network Node (MC13224 and MC13226)
•MC1322x Low Power Node (MC13224 only)
•MC1322x USB (MC13224 only)
The changes required in the software to support any of the Freescale transceivers are generated
automatically by BeeKit after exporting a solution with the projects correctly configured. For more
information on exporting projects, see the BeeKit Wireless Connectivity Toolkit User’s Guide
(BKWCTKUG) and the BeeKit on-line help.
2.3Optional Modules
2.3.1OTAP Module
The Over the Air Programmer (OTAP) application 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 on a board with a new application. Two boards are required for the OTAP
application:
•One board used as the OTAP Programmer
•One board used as the OTAP-enabled target
Freescale recommends that both of the images to be flashed are OTAP-enabled applications.
The following summarizes what users will accomplish with the OTAP application:
•On the OTAP Programmer Board:
— Download and run the OTAP Programmer software
— Download an OTAP-enabled application via the UART.
– The downloaded application must have its OTAP module property enabled when the project
is generated in BeeKit
— Any of the MC1322x development boards can be used as the OTAP Programmer
2-2Freescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Software Architecture
•OTAP-enabled target Board (The board having its firmware updated.)
— Download and run an OTAP-enabled application on the board. The currently loaded
application will be replaced by the new application using the OTAP Programmer.
– The application being replaced must have its OTAP module property enabled when the
project is generated in BeeKit.
— Any of the MC1322x development boards can be used as an OTAP enabled target board.
2.3.2Security Module
The security module is a software component that allows the ciphering and deciphering of messages
through its API. This section describes the procedure for implementing security in a MC1322x SMAC
application.
The MC1322x SMAC security management module allows implementation of wireless security
mechanisms. The MC1322x SMAC security module defines all functions required to cipher and decipher
the messages to be sent or received with the MC1322x SMAC on the MC1322x transceiver. The cipher
process is executed by the ASM module which implements the AES algorithm. It can perform CTR, CBC,
and CCM. CCM is a combination of CTR and CBC. For further details about the security implemented on
22x SMAC and the MC1322x, see Annex B of the IEEE standard 802.15.4-2003.
To enable security features, the security module must first be initialized, then the key and counter must be
set. After that, plain/cipher text can be ciphered/deciphered.
NOTE
The resulting ciphered/deciphered text is put on the same buffer where the
plain text is provided, for CBC and CCM modes which generate Message
Authentication Code, the provided buffer must also allocate 16 extra bytes
for the MAC.
This section describes the MC1322x SMAC messages, their types, operations and states. Send and receive
are basic functions of the MC1322x SMAC and they are implemented as messages. Energy detection and
radio idle time out are also implemented as messages. That is why messages are the core of the MC1322x
SMAC and it is important to explain the messages in detail both in how are they structured and how they
are processed and interfaced.
Freescale Semiconductor2-3
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Software Architecture
Messages are processed by the Radio Management module. The Radio Management module has a circular
queue with the messages that need to be processed as a FIFO structure. The messages are attended in the
same order as they arrive.
Messages are added to the message queue using the following functions:
•MCPSDataRequest (for TX messages)
•MLMERXEnableRequest (for RX messages)
•MLMEEnergyDetect (for ED messages)
These functions call the Radio Management handle_new_message function.
Because the messages are processed by their states, the process_radio_msg function must also be called
periodically to run the message state machine.
2.4.1Message Types
The MC1322x SMAC defines four types of messages:
•Reception (RX)
•Transmission (TX)
•Energy Detect (ED)
•Time out (TO)
These types of messages are directly related with radio operation. Messages types are defined at the
enumeration msg_type_t declared in the RadioManagement.h file. Each type of message has its own life
cycle. This cycle is defined by the different states that a message can take. The following code declared at
the RadioManagement.h file describes each message state: