Freescale Semiconductor MC1322x Reference Manual

MC1322x Simple Media Access
Controller (SMAC)
Reference Manual
Document Number: 22xSMACRM
Rev. 1.7
09/2011
Home Page:
www.freescale.com
E-mail:
support@freescale.com
USA/Europe or Locations Not Listed:
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
Europe, Middle East, and Africa:
Freescale Halbleiter Deutschland GmbH Technical Information Center Schatzbogen 7 81829 Muenchen, Germany +44 1296 380 456 (English) +46 8 52200080 (English) +49 89 92103 559 (German) +33 1 69 35 48 48 (French) support@freescale.com
Japan:
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.
Copyright © 2007 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.
© Freescale Semiconductor, Inc. 2005, 2006, 2007, 2008, 2009, 2010, 2011. All rights reserved.
Contents
About This Book
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Definitions, Acronyms, and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Chapter 1 MC1322x SMAC Introduction
1.1 Available Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.2 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.3 MCU Resource Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.4 Introducing BeeKit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.4.1 BeeKit Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Chapter 2 MC1322x SMAC Software Architecture
2.1 MC1322x SMAC Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.2 Hardware Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.3 Optional Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.3.1 OTAP Module. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.3.2 Security Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.4 MC1322x SMAC Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.4.1 Message Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.4.2 Message State Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.4.3 Message Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.5 MC1322x SMAC Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.5.1 message_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.6 Generic Application Code Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Chapter 3 MC1322x SMAC Primitives
3.1 Common Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.1.1 callback_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.1.2 FuncReturn_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.2 Core SMAC API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3.2.1 ConfigureBuckRegulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3.2.2 DRVConfigureRTC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.2.3 MCPSDataRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.2.4 MLMEDozeRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
3.2.5 MLMEEnergyDetect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-5
3.2.6 MLMEGetChannelRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3.2.7 MLMEGetPromiscuousMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
Freescale Semiconductor i
MC1322x SMAC Reference Manual, Rev. 1.7
3.2.8 MLMEGetRficVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
3.2.9 MLMEHibernateRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
3.2.10 MLMELinkQuality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
3.2.11 MLMEPAOutputAdjust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
3.2.12 MLMEPHYResetIndication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
3.2.13 MLMEPHYSoftReset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
3.2.14 MLMEPHYXtalAdjust. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
3.2.15 MLMERadioInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
3.2.16 MLMERXDisableRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
3.2.17 MLMERXEnableRequest. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
3.2.18 MLMEScanRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
3.2.19 MLMESetChannelRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
3.2.20 MLMESetPromiscuousMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
3.2.21 MLMESetWakeupSource. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
3.2.22 MLMETestMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
3.3 Security - Module API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
3.3.1 CipherConfigure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
3.3.2 CipherEngineInit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
3.3.3 CipherMsg and CipherMsgU8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
3.3.4 DecipherMsg and DecipherMsgU8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
3.4 OTAP - Module API. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
3.4.1 OTAP_data_indication_execute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
3.4.2 OTAP_execute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
3.4.3 OTAP_Init . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23
3.5 Support Function API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24
3.5.1 ConfigureRfCtlSignals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-24
3.5.2 SetEdCcaThreshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-25
3.5.3 SetComplementaryPAState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-25
3.5.4 SetDemulatorMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-26
3.5.5 SetPowerLevelLockMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
3.5.6 RadioInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-27
ii Freescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
About This Book
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 1 MC1322x SMAC Introduction — This chapter introduces the MC1322x SMAC
features and functionality.
Chapter 2 MC1322x SMAC Software Architecture — This chapter describes the MC1322x
SMAC software architecture.
Chapter 3 MC1322x 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
Location Revision
Chapter 3 Added new function
Freescale Semiconductor iii
MC1322x SMAC Reference Manual, Rev. 1.7
Definitions, Acronyms, and Abbreviations
The following list defines the acronyms and abbreviations used in this document.
AES Advanced Encryption Standard
API Application Programming Interface
ASM Advanced Security Module
BDM debugger A debugger using the BDM interface for communication with the MCU. An
example is the P&E BDM Multilink debugger for HCS08
BDM Background Debug Module
CBC Cipher Block Chaining
CBC-MAC Cipher Block Chaining Message Authentication Code
CCM Counter with CBC-MAC
CTR Counter
dBm Decibels relative to one milliwatt.
EN End Node - Evaluation Boards
EVB Evaluation Boards
EVK Evaluation Kit
GUI Graphical User Interface
IDE Integrated Development Environment
MAC Medium Access Control
MAC2 Message Authentication Code
MCU MicroController Unit
NVM Non-volatile Memory
OTAP Over The Air Programming
PC Personal Computer
PCB Printed Circuit Board
S19 S - 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 Boot The Embedded Bootloader boots up using safe default system values
SMAC Simple Media Access Controller
iv Freescale 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 Semiconductor 1-1
MC1322x SMAC Introduction
1.1 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.
1.2 Features
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-2 Freescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Introduction
1.3 MCU 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.4 Introducing 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.1 BeeKit 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).
Codebase A 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.
Solution A 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 Project A 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 File A 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 Semiconductor 1-3
MC1322x SMAC Reference Manual, Rev. 1.7
MC1322x SMAC Introduction
Figure 1-1. Example Project Folder Structure
1-4 Freescale 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.1 MC1322x 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 Semiconductor 2-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.2 Hardware 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.3 Optional Modules
2.3.1 OTAP 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-2 Freescale 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.2 Security 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.
The Security Module API is as follows:
FuncReturn_t CipherEngineInit(void) FuncReturn_t CipherConfigure(cipher_mode_t u8CipherMode, cipher_key_t * pCipherKey, ctr_value_t * pCtrValue) FuncReturn_t CipherMsg (uint32_t * pu32CipherBuffer, uint8_t u8BufferLength) FuncReturn_t DecipherMsg (uint32_t *pu32DecipherBuffer, uint8_t u8BufferLength) FuncReturn_t CipherMsgU8(uint8_t *pu8CipherBuffer, uint8_t u8BufferLength) FuncReturn_t DecipherMsgU8(uint8_t *pu8CipherBuffer, uint8_t u8BufferLength)
2.4 MC1322x SMAC Messages
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 Semiconductor 2-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.1 Message 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:
2-4 Freescale Semiconductor
MC1322x SMAC Reference Manual, Rev. 1.7
Transmit
typedef enum msg_tx_state_tag{ MSG_TX_RQST = initial_state_c, MSG_TX_PASSED_TO_DEVICE, MSG_TX_ACTION_STARTED, MSG_TX_ACTION_COMPLETE_CHANN_BUSY, MSG_TX_ACTION_COMPLETE_SUCCESS, MSG_TX_ACTION_COMPLETE_FAIL, MSG_TX_RQST_ABORT, MSG_TX_ABORTED, MAX_MSG_TX_STATE }msg_tx_state_t;
Receive
typedef enum msg_rx_state_tag{ MSG_RX_RQST = initial_state_c, MSG_RX_PASSED_TO_DEVICE, MSG_RX_ACTION_STARTED, MSG_RX_SYNC_FOUND, MSG_RX_TIMEOUT_FAIL, MSG_RX_ACTION_COMPLETE_SUCCESS, MSG_RX_ACTION_COMPLETE_FAIL, MSG_RX_RQST_ABORT, MSG_RX_ABORTED, MAX_MSG_RX_STATE }msg_rx_state_t;
MC1322x SMAC Software Architecture
Energy Detect
typedef enum msg_ed_state_tag{ MSG_ED_RQST = initial_state_c, MSG_ED_PASSED_TO_DEVICE, MSG_ED_ACTION_COMPLETE_SUCCESS, MSG_ED_ACTION_COMPLETE_FAIL, MSG_ED_RQST_ABORT, MSG_ED_ABORTED, MAX_MSG_ED_STATE }msg_ed_state_t;
Timeout
typedef enum msg_to_state_tag { MSG_TO_RQST = initial_state_c, MSG_TO_PASSED_TO_DEVICE, MSG_TO_ACTION_COMPLETE_SUCCESS, MSG_TO_ACTION_COMPLETE_FAIL, MSG_TO_RQST_ABORT, MSG_TO_ABORTED,
MC1322x SMAC Reference Manual, Rev. 1.7
Freescale Semiconductor 2-5
Loading...
+ 33 hidden pages