NXP Semiconductors SMAC User manual

Document Number: SMAC08RM
Rev. 2.0
03/2012
Simple Media Access Controller
(SMAC) for the HCS08
Reference Manual

How to Reach Us:
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.jap[email protected]
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.
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. 2006, 2007, 2008, 2009, 2010, 2011, 2012. All rights reserved.

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor iii
Contents
About This Book
Audience . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v
Definitions, Acronyms, and Abbreviations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
References. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Chapter 1
SMAC Introduction
1.1 Features. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.2 Hardware Configurations - Required MCU Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.3 Freescale Integrated Development Environment (IDE) - BeeKit. . . . . . . . . . . . . . . . . . . . . . . . 1-2
1.4 Using BeeKit. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.4.1 BeeKit Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Chapter 2
Software Architecture
2.1 Block Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.2 Hardware Support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.3 SMAC Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2.3.1 rxPacket_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.3.2 rxStatus_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3
2.3.3 smacPdu_t. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.3.4 txPacket_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-4
2.3.5 txStatus_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
2.3.6 channels_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
2.3.7 clkoFrequency_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.3.8 scanModes_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-6
2.3.9 smacErrors_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.3.10 smacTestMode_t. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-7
2.3.11 timerTimeBase_t. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
2.3.12 versionedEntity_t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-8
Chapter 3
Primitives
3.1 Application API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.1.1 MCPSDataRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.1.2 MLMELinkQuality. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2
3.1.3 MLMERXDisableRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.1.4 MLMERXEnableRequest. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.1.5 MLMEDozeRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
3.1.6 MLMEEnergyDetect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
iv Freescale Semiconductor
3.1.7 MLMEFEGainAdjust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3.1.8 MLMEGetChannelRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
3.1.9 MLMEHibernateRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
3.1.10 MLMEPAOutputAdjust . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
3.1.11 MLMEPHYSoftReset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
3.1.12 MLMERadioInit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
3.1.13 MLMESetChannelRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-10
3.1.14 MLMESetClockRate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-11
3.1.15 MLMESetTmrPrescale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-12
3.1.16 MLMEWakeRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
3.1.17 MLMEPHYXtalAdjust. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-13
3.1.18 XCVRContReset. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-14
3.1.19 XCVRRestart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
3.1.20 MLMEGetPromiscuousMode. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-15
3.1.21 MLMEGetRficVersion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
3.1.22 MLMEScanRequest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
3.1.23 MLMESetPromiscuousMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
3.1.24 MLMETestMode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-18
3.1.25 SMACDisableInterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-19
3.1.26 SMACEnableInterrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
3.1.27 MCPSDataComfirm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-20
3.1.28 MCPSDataIndication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
3.1.29 MLMEResetIndication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
3.1.30 MLMEScanComfirm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
3.1.31 MLMEWakeComfirm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor v
About This Book
This guide provides a detailed description of the Freescale Simple Media Access Controller (SMAC) for
the HCS08 MCU based devices.
This document replaces the SMAC User’s Guide currently at Rev 1.5.
Audience
This document is intended for application developers 802.15.4 PHY wireless applications. The latest
version of the Freescale SMAC for the HCS08 is incorporated into the Freescale BeeKit Wireless
Connectivity Toolkit.
Organization
This document is organized into the following chapters.
Chapter 1 SMAC Introduction — This chapter introduces SMAC features and
functionality.
Chapter 2 Software Architecture — This chapter describes SMAC software architecture.
Chapter 3 Primitives — This chapter provides a detailed description of SMAC primitives.
Revision History
The following table summarizes revisions to this document since the previous release (Rev. 1.0).
Revision History
Location Revision
Throughout Removed MC13219x references.
Throughout Added information for MC13234
devices.
Chapter 1 Removed OTA, SNET, Low Power
Bell, and Accelerometer references
Chapter 3 Removed UseExternalClock,
UseMCUClock, and MCUInit sections.

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
vi Freescale Semiconductor
Definitions, Acronyms, and Abbreviations
The following list defines the acronyms and abbreviations used in this document.
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
EVB Evaluation Boards - this term covers the 13192-EVB, 13192-SARD and
1320X-QE128-EVB boards.
EVK Evaluation Kit
GUI Graphical User Interface
MAC Medium Access Control
MCU MicroController Unit
NVM Non-Volatile Memory
PC Personal Computer
PCB Printed Circuit Board
S19 '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).
HIWAVE P&E HCS08 debugger GUI.
CPROG P&E HCS08 flash programming tool called from HIWAVE. The tool is also
available in a command line version where scripts can be made.
OTA Over the air.
References
The following sources were referenced to produce this book:
[1] Freescale 802.15.4 MAC/PHY Software Reference Manual (802154MPSRM)
[2] Zigbee.hlp (see Test Tool installation directory.\help)

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 1-1
Chapter 1
SMAC Introduction
Freescale supplies a number of IEEE 802.15.4 Standard compliant platforms for the 2.4 GHz ISM band.
Applications software for a number of these devices is based on the HCS08 8-bit MCU architecture, and
the Simple Media Access Controller (SMAC) is a simple ANSI C based code stack available as sample
source code. The SMAC is used for evaluating new designs, doing RF testing, and developing simple
proprietary IEEE 802.15.4 transceiver applications.
The SMAC can be used with the following device families:
1. MC1320x - this device is an IEEE 802.15.4 transceiver only, and is used typically with an
MC9S08GB/GT MCU. The transceiver is controlled primarily through a SPI communication port.
This device is a second generation to the MC1319x.
2. MC1321x - this device combines the MC1320x transceiver and an MC9S08GB60A MCU in a
single package. This configuration is architecturally similar to an MC1320x application; the
transceiver is still controlled primarily through a SPI communication port.
3. MC1323x - this device a full system on chip where the RF transceiver is integral to the IC and
appears as a peripheral to the MCU bus. As a result, the SMAC applies differently as to how it
communicates with and controls the transceiver, and also how communication services are
provided. SMAC includes support for two devices of this platform:
— MC13233
— MC13234
NOTE
• The MC1320x devices can be used with other MCU architectures. In
this situation, SMAC can be used as a template and adapted to the
targeted architecture.
• The SMAC is intended as an evaluation/test utility and for simple
applications. For more complex applications, the user is strongly
recommended to consider Freescale’s other IEEE 802.15.4 MAC-based
stacks.
• When applying SMAC to any given device, it is recommended that the
user become familiar with the device via the appropriate Reference
Manual and Data Sheet.

SMAC Introduction
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
1-2 Freescale Semiconductor
1.1 Features
• Compact footprint:
— Between 3 and 5K FLASH depending on configuration and platform used
— From [(23 to 293) plus maximum packet length] bytes of RAM depending on configuration and
platform used.
• MC1320x, MC1321x, and MC1323x compatible
• Proprietary, bi-directional RF communication link - custom frame format
• Low power features
• ANSI C source code targeted for the HCS08 core
• Low priority IRQ
• Easy-to-use sample applications included
• Programmable protocol function to allow automatically ignore standard IEEE 802.15.4 Standard
MAC packets
1.2 Hardware Configurations - Required MCU Resources
There are two fundamental hardware configurations used with SMAC:
1. Separate transceiver and MCU - the MC1320x and MC1321x employ this configuration. The
MC1321x is unique in that the system connections are on board a single package. MCU support
requirements include:
— System clock requirements - the transceiver requires a 16 MHz crystal for its reference
oscillator. Common practice is to use a clock output (CLKO) from the transceiver to drive the
MCU as an external clock source. It is still required, however, that the MCU have some
internal/local clock source for startup.
— Transceiver/MCU communication SPI port - four MCU GPIO pins are required for the SPI port
(CLK, MISO, MOSI, and CE/SS). Although the SPI port could be provided by a “bit-banged”
software driven interface, most common practice is a dedicated SPI peripheral module.
— Addition control GPIO - additional MCU GPIO are required for transceiver control and status.
At minimum, three IO are needed (Reset, RTXEN, and ATTN), however, as many as seven
GPIOs can be used
— One MCU pin capable of external interrupt request - this may be a dedicated IRQ pin, a KBI
pin, or any GPIO capable of generating an IRQ based on an incoming signal transition.
1.3 Freescale Integrated Development Environment (IDE) - BeeKit
The SMAC is incorporated into the Freescale BeeKit Wireless Connectivity Toolkit. The incorporation of
SMAC into BeeKit makes it easier for users to employ and customize SMAC. SMAC has evolved with
the HCS08 platforms, and as a result, changes have occurred with later versions. The primary changes are
as follows:
• No blocking functions are on the most recent SMAC implementation
• Modified arguments and return types

SMAC Introduction
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 1-3
• Specific part number removed from the API function names
If migrating from a previous SMAC version, Freescale recommends comparing specific function details.
In addition to the SMAC codebase, Freescale includes a suite of demonstration applications for SMAC.
A list of SMAC-based applications includes:
• Generic Demo — Provides an empty template to start coding an SMAC application.
• Connectivity Test — Provides an easy way to test the RF performance of the transceiver for basic
transmitter and receiver tests. It includes TX test modes (continuous tx, modulated, unmodulated,
etc.), Packet Error Rate PER) tests, and Range tests (LQI measurements).
• Wireless UART — Application allows the Freescale IEEE 802.15.4 family of boards to
communicate at standard serial baud rates from one board to another providing a wireless RS-232
or USB virtual COM port.
• Range Demonstration — Employs the Range Demonstration Plus application to determine
/evaluate the maximum wireless node board RF range.
• Repeater Demonstration — Uses the Repeater application to repeat all the messages received in a
specific channel to extend the range of a point-to-point link.
• Simple ZigBee Test Client (SZTC) — Application allows users to exercise the SMAC primitives
by sending control frames through the Serial/USB port.
For more details about running the SMAC applications refer to the SMAC for the HCS08 Demonstration
Applications User’s Guide (SMAC08DAUG).
To use any of the existing applications available in SMAC, users must first generate the application as a
project 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.
1.4 Using BeeKit
SMAC is released in an independent codebase that is part of the Freescale BeeKit Wireless Connectivity
Tool. To create a project for SMAC, users must employ the BeeKit Codebase that contains the 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 SMAC, see SMAC for the HCS08 Demonstration
Applications User’s Guide (SMAC08DAUG).
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.

SMAC Introduction
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
1-4 Freescale Semiconductor
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 that are exported from BeeKit to create a CodeWarrior
project in the form of an XML file.
XML Project File A BeeKit generated XML file ready for import into CodeWarrior. A CodeWarrior
MCP file is generated from the BeeKit generated XML project file.
Figure 1-1 shows the folder structure of a typical project generated using SMAC Codebase for BeeKit.
Figure 1-1. Example Project Folder Structure

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 2-1
Chapter 2
Software Architecture
This chapter describes the SMAC software architecture. In this version of the SMAC, all of the SMAC
source code is included in the application. This represents a far less complex project that can be compiled
using CodeWarrior Special Edition.
2.1 Block Diagram
Figure 2-1 shows the SMAC block diagram. As shown in Figure 2-1, the various SMAC software
components also specify the implemented file names.
• Security Module
Figure 2-1. SMAC Layer Diagram
The Security modules and its API are included in the BeeKit project when the corresponding SMAC
BeeKit property is set to “True”:
An API is implemented in the SMAC as a C header file (.h) that allows access to the code. The code
includes the API to specific functions. So, the application interface with the SMAC is accomplished by
including the SMAC_Interface.h file, which makes references to the required functions within the SMAC
and provides the application with SMAC functionality.

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
2-2 Freescale Semiconductor
2.2 Hardware Support
This section describes the SMAC hardware support for the MCU, transceiver, antenna switch, and LNA.
The SMAC can be easily ported to any MCU, as long as the system requirements are met. To port to
another MCU, perform the following tasks:
1. Remove the mc9s08gb60.c/mc9sqe128.c/mc1323c.c file from the BeeKit project.
2. Add the specific c support file for the required MCU
3. Update the linker file (.prm file)
4. Update the derivative.h file to include the specific header file
5. Update the SMAC lower layers (MCU and SPI configuration files)
6. Update the application drivers (such as SCI, LED, KBI, etc.)
The SMAC supports the following Freescale transceiver families:
• MC1320x
• MC1321x
• MC1323x, including MC13233 and MC13234
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.
SMAC projects support different target boards (those available in Freescale ZigBee kits) in the files. But
it is easy to port an SMAC application from a standard target to a custom target by using the Platform
Editor Wizard in Beekit.
The SMAC contains support for hardware that is controlled by GPIOs configured at the target board
header file: These hardware options are as follows:
• External Antenna Switch
•LNA
•PA
For the External Antenna Switch, SMAC supports the following configurations:
• For the MC1320x and MC1321x transceivers, a single antenna using an external antenna switch
controlled by an MCU GPIO pin.
• For MC1320x and MC1321x transceivers, a single antenna using an external antenna switch
controlled by the BT_Bias pin of the transceiver.
• For MC1320x and MC1321x transceivers, a single antenna using the internal antenna switch.
2.3 SMAC Data Types
The following list shows the fundamental data types and the naming convention used in SMAC:
uint8_t Unsigned 8 bit definition
uint16_t Unsigned 16 bit definition

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 2-3
uint32_t Unsigned 32 bit definition
int8_t Signed 8 bit definition
int162_t Signed 16 bit definition
int32_t Signed 32 bit definition
These data types are used in the SMAC project as well as in the Applications projects and they are defined
in the EmbeddedTypes.h file.
2.3.1 rxPacket_t
This structure defines the variable to be used for SMAC receiving data buffer:
typedef struct rxPacket_tag
{
uint8_t u8MaxDataLength;
rxStatus_t rxStatus;
uint8_t u8DataLength;
smacPdu_t smacPdu;
}rxPacket_t;
Members
u8MaxDataLength Max number of bytes to be received.
rxStatus Indicates the reception state, see rxStatus_t data type for more detail.
u8DataLength Number of received bytes.
smacPdu Data reception buffer, see smacPdu_t data type for more detail.
Usage
This data type is used by an application in the following manner:
1. Declare a pointer to rxPacket_t variable
2. Assign that variable the pointer to an array selected for receiving.
3. Use that variable as the argument when calling MLMERXEnableRequest
rxPacket_t *RxPacket;
uint8_t RxDataBuffer[130];
...
RxPacket = (rxPacket_t*)RxDataBuffer;
RxEnableResult = MLMERXEnableRequest(RxPacket, 0);
...
2.3.2 rxStatus_t
This enumeration list all the possible reception states:
typedef enum rxStatus_tag{
rxInitStatus,
rxProcessingReceptionStatus_c,
rxSuccessStatus_c,

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
2-4 Freescale Semiconductor
rxTimeOutStatus_c,
rxAbortedStatus_c,
rxMaxStatus_c
}rxStatus_t;
Members
rxInitStatus SMAC set this state when starting a reception.
rxProcessingReceptionStatus_c This state is set when the SMAC is in the middle of receiving a packet.
rxSuccessStatus_c This is one of the possible finish condition for a receiving packet that was
successfully received and could be checked at the indication functions.
rxTimeOutStatus_c This is one of the possible finish condition for a time out condition and could be
checked at the indication functions..
rxAbortedStatus_c This is one of the possible finish condition for a receiving packet that was not
received due to sync lost or an reception disable has been commanded and could
be checked at the indication functions.
rxMaxStatus_c This element indicate the total number of possible reception states.
2.3.3 smacPdu_t
This structure defines the variable to be used for SMAC data buffer:
typedef struct smacPdu_tag {
uint8_t reserved[2];
uint8_t u8Data[1];
}smacPdu_t;
Members
reserved Reserved.
u8Data The data buffer to transmit.
2.3.4 txPacket_t
This structure defines the variable to be transmitted by SMAC. It is located in the SMAC_Interface.h file
and is defined as follows:
typedef struct txPacket_tag{
uint8_t u8DataLength;
smacPdu_t smacPdu;
}txPacket_t;
Members
u8DataLength The number of bytes to transmit.
smacPdu The data buffer to transmit.

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 2-5
Usage
This data type is used by an application in the following manner:
1. Declare a pointer to txPacket_t variable
2. Assign that variable the pointer to an array selected for transmitting.
3. Assign the appropriate value to the txPacket_t element of the txStatus_t structure
4. Use that variable as the argument when calling MCPSDataRequest
uint8_t TxDataBuffer[TX_DATA_BUFFER_SIZE];
txPacket_t *TxPacket;
...
TxPacket = (txPacket_t*)TxDataBuffer;
TxPacket->u8DataLength = MAX_DATA_LENGTH;
DataRequestResult = MCPSDataRequest(TxPacket);
...
2.3.5 txStatus_t
This enumeration lists all the possible transmitting states. It is located in the SMAC_Interface.h file and is
defined as follows:
typedef enum txStatus_tag{
txSuccessStatus_c,
txFailureStatus_c,
txMaxStatus_c
}txStatus_t;
Members
txSuccessStatus_c Indicates that the transmission was successfully executed can be validated at the
confirm function.
txFailureStatus_c Indicates there was an issue when transmitting and it can not be completed.
txMaxStatus_c Indicates the total number of possible transmission states.
2.3.6 channels_t
This structure defines the variable to be received by the SMAC and is located in the SMAC_Interface.h file.
It is defined as follows:
typedef enum channels_tag{
gChannel11_c = 0x0B,
gChannel12_c,
gChannel13_c,
gChannel14_c,
gChannel15_c,
gChannel16_c,
gChannel17_c,
gChannel18_c,
gChannel19_c,
gChannel20_c,
gChannel21_c,
gChannel22_c,
gChannel23_c,

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
2-6 Freescale Semiconductor
gChannel24_c,
gChannel25_c,
gChannel26_c,
gTotalChannels_c
}channels_t;
Members
gChannelXX_c Constant used to refer the IEEE 802.15.4 channel XX
gTotalChannels_c Constant indicates the total number of channels.
2.3.7 clkoFrequency_t
This enumeration list all the possible clock output frequencies and is located in the SMAC_Interface.h file.
It is defined as follows:
typedef enum clkoFrequency_tag{
gClko16MHz_c,
gClko8MHz_c,
gClko4MHz_c,
gClko2MHz_c,
gClko1MHz_c,
gClko62p5kHz_c,
gClko32p786kHz_c,
gClko16p393kHz_c,
gClkoOutOfRange_c
}clkoFrequency_t;
Members
gClko[XY]Hz_c Constant used to indicate a [XY] Hz clock output.
gClkoOutOfRange_c Constant indicates the total number of possible clock output valid selections.
2.3.8 scanModes_t
This enumeration list all the scanning methods available on SMAC and is located in the SMAC_Interface.h
file. It is defined as follows:
typedef enum scanModes_tag{
gScanModeCCA_c,
gScanModeED_c,
gMaxScanMode_c
}scanModes_t;
Members
gScanModeCCA_c Constant used to indicate a CCA scan mode, that is comparing actual energy level
against a defined threshold and binary reporting it bit mapped on a 16 bit variable.
gScanModeED_c Constant used to indicate a ED scan mode, that is reading the actual energy level
and storing such value on a 8 bits variable.
gMaxScanMode_c Constant indicates the total number of possible scan methods available at SMAC.

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 2-7
2.3.9 smacErrors_t
This enumeration is used as the set of possible return values on most of the SMAC API functions and is
located in the SMAC_Interface.h:
typedef enum smacErrors_tag{
gErrorNoError_c = 0,
gErrorBusy_c,
gErrorOutOfRange_c,
gErrorNoResourcesAvailable_c,
gErrorNoValidCondition_c,
gErrorCorrupted_c,
gErrorMaxError_c
}smacErrors_t;
Members
gErrorNoError_c SMAC accept the request and will process it. NOTE that this return value does not
necessary mean that the action requested was successful executed, it just means
that is that accepted to be process by SMAC
gErrorBusy_c This constant is returned when SMAC layer is not on a idle state, then it can not
perform the requested action.
gErrorOutOfRange_c One or more of the parameters used when calling the function are out of the valid
values range.
gErrorNoResourcesAvailable_c PHY or other lower layer is not able to process SMAC request then
SMAC can not process it.
gErrorNoValidCondition_cWhen requesting an action on an invalid environment. Requesting SMAC
operations when SMAC has not been initialized or requesting awake the radio
when it was not in low power mode.
gErrorCorrupted_c Not used.
gErrorMaxError_c This constant indicates the total number of return constants.
2.3.10 smacTestMode_t
This enumeration is used as the set of possible radio test modes that SMAC implements and is located in
the SMAC_Interface.h:
typedef enum smacTestMode_tag{
gTestModePRBS9_c,
gTestModeForceIdle_c,
gTestModeContinuousRx_c,
gTestModeContinuousTxModulated_c,
gTestModeContinuousTxUnmodulated_c,
gMaxTestMode_c
}smacTestMode_t;
Members
gTestModePRBS9_c
gTestModeForceIdle_c

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
2-8 Freescale Semiconductor
gTestModeContinuousRx_c
gTestModeContinuousTxModulated_c
gTestModeContinuousTxUnmodulated_c
gMaxTestMode_c
2.3.11 timerTimeBase_t
This enumeration is used as the set of possible transceiver timer base, is located in the SMAC_Interface.h.
and is defined for the MC1323x platform as:
typedef enum timerTimeBase_tag {
gTimeBase500kHz_c = 2,
gTimeBase250kHz_c,
gTimeBase125kHz_c,
gTimeBase62p5kHz_c,
gTimeBase31p25kHz_c,
gTimeBase16p625kHz_c,
gMaxTimeBase_c
}timerTimeBase_t;
And defined for the other supported platforms as:
typedef enum timerTimeBase_tag{
gTimeBase2MHz_c = 0,
gTimeBase1MHz_c,
gTimeBase500kHz_c,
gTimeBase250kHz_c,
gTimeBase125kHz_c,
gTimeBase62p5kHz_c,
gTimeBase31p25kHz_c,
gTimeBase16p625kHz_c,
gMaxTimeBase_c
}timerTimeBase_t
Members
gTimeBaseXXHz_c Use to set the transceiver timer base at XX Hz.
gMaxTimeBase_c Used for validation purposes.
2.3.12 versionedEntity_t
This enumeration lists all the elements (HW or SW) that have a version attached and is located in the
SMAC_Interface.h file.
typedef enum versionedEntity_tag{
gSwSmacVersion_c,
gHwIcVersion_c,
gMaxVersionedEntity_c
}versionedEntity_t;
Members
gSwSmacVersion_c Use this to request the SMAC version.

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
Freescale Semiconductor 2-9
gHwIcVersion_c Use this to request the Transceiver/SoC version number.
gMaxVersionedEntity_c Defines the total number of versions entities.

Software Architecture
Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0
2-10 Freescale Semiconductor
Table of contents
Other NXP Semiconductors IP Access Controllers manuals