NXP Semiconductors MKW01 User manual

Document Number: MKW01SMACRM
Rev. 0.0
3/2015
MKW01 Simple Media Access
Controller (SMAC)
Reference Manual

How to Reach Us:
Home Page:
www.freescale.com
E-mail:
support@freescale.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
hereundertodesign or fabricate any integrated circuitsorintegratedcircuitsbased 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
andallliability,includingwithoutlimitationconsequentialorincidentaldamages.“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 ofthe 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. 2013, 2014. All rights reserved.

MKW01 Simple Media Access Controller (SMAC), Rev. 0.0
Freescale Semiconductor 1
Chapter 1.
MKW01 SMAC Introduction
1.1. MKW01 SMAC-based Demonstration Applications ..............................................................6
1.2. Platform Requirements ............................................................................................................7
1.3. MCU Resources Used by SMAC ............................................................................................7
1.4. SMAC Basic Initialization .......................................................................................................7
Chapter 2.
Software Architecture
2.1. Block Diagram .........................................................................................................................9
2.2. MKW01 SMAC Data Types and Structures ..........................................................................10
2.2.1 Fundamental Data Types ................................................................................................. 10
2.2.2 rxPacket_t ........................................................................................................................ 10
2.2.3 smacHeader_t................................................................................................................... 11
2.2.4 rxStatus_t ......................................................................................................................... 12
2.2.5 smacPdu_t........................................................................................................................ 12
2.2.6 txPacket_t......................................................................................................................... 12
2.2.7 channels_t ........................................................................................................................ 13
2.2.8 smacErrors_t.................................................................................................................... 14
2.2.9 txContextConfig_t ........................................................................................................... 15
2.2.10 smacTestMode_t............................................................................................................ 15
2.2.11 packetConfig_t............................................................................................................... 15
2.2.12 smacRFModes_t ............................................................................................................ 16
2.2.13 smacEncryptionKeyIV_t ............................................................................................... 16
2.3. MKW01 SMAC to Application Messaging ...........................................................................17
Chapter 3.
Primitives
3.1. MCPSDataRequest ................................................................................................................21
3.2. MLMETXDisableRequest .....................................................................................................22
3.3. MLMEConfigureTxContext ..................................................................................................23
3.4. MLMERXEnableRequest ......................................................................................................24
3.5. MLMERXDisableRequest .....................................................................................................25
3.6. MLMELinkQuality ................................................................................................................26
3.7. MLMESetChannelRequest ....................................................................................................26
3.8. MLMEGetChannelRequest ...................................................................................................27
3.9. MLMEPAOutputAdjust .........................................................................................................27
3.10. MLMEPhySoftReset ............................................................................................................28
3.11. MLMEScanRequest .............................................................................................................28
3.12. MLMECcaRequest ..............................................................................................................29

MKW01 Simple Media Access Controller (SMAC), Rev. 0.0
2Freescale Semiconductor
3.13. MLMESetPreambleLength ..................................................................................................30
3.14. MLMESetSyncWordSize ....................................................................................................30
3.15. MLMESetSyncWordValue ..................................................................................................30
3.16. MLMEPacketConfig ............................................................................................................31
3.17. MLMESetAdditionalRFOffset ............................................................................................31
3.18. MLMEGetAdditionalRFOffset ............................................................................................32
3.19. SMACSetShortSrcAddress ..................................................................................................32
3.20. SMACSetPanID ...................................................................................................................33
3.21. SMACFillHeader .................................................................................................................34
3.22. SMAC_SetIVKey ................................................................................................................34
3.23. Smac_RegisterSapHandlers .................................................................................................35

MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 3
About This Book
This manual provides a detailed description of the Freescale MKW01 Simple Media Access Controller
(MKW01 SMAC). This software is designed for use specifically with the MKW01 platform. The MKW01
is a highly-integrated, cost-effective, system-in-package (SiP), sub-1 GHz wireless node solution with an
FSK, GFSK, MSK, or OOK modulation-capable transceiver and low-power, ARM Cortex M0+ 32-bit
microcontroller. The highly integrated RF transceiver operates over a wide frequency range including 315
MHz, 433 MHz, 470 MHz, 868 MHz, 915 MHz, 928 MHz, and 955 MHz in the license-free Industrial,
Scientific, and Medical (ISM) frequency bands.
The MKW01 SMAC software is pre-defined to operate in the 470–510 MHz , 863–870 MHz, 902–928
MHz and 920–928 MHz bands.
Audience
This document is intended for application developers working on custom wireless applications that
employ the MKW01. The latest version of the Freescale MKW01 SMAC is available in the Freescale
website.
Organization
This document is organized into four chapters and one appendix.
Chapter 1 MKW01 SMAC Introduction — This chapter introduces MKW01 SMAC
features and functionality.
Chapter 2 Software Architecture — This chapter describes MKW01 SMAC software
architecture.
Chapter 3 Primitives — This chapter provides a detailed description of MKW01 SMAC
primitives.
Revision History
The following table summarizes revisions to this document since the previous release.
Conventions
This document uses the following notational conventions:
•Courier monospaced type indicate commands, command parameters, code examples,
expressions, datatypes, and directives.
•Italic type indicates replaceable command parameters.
• All source code examples are in C.
Revision History
Location Revision
MKW01SMACRM This is the first release of the RTOS
and KSDK enabled SMAC manual.

MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
4Freescale Semiconductor
Definitions, Acronyms, and Abbreviations
The following list defines the acronyms and abbreviations used in this document.
MKW01 MKW01 Platforms (FRDM-KW01, MRB-KW01, USB-KW01)
GUI Graphical User Interface
MAC Medium Access Control
MCU MicroController Unit
NVM Non-Volatile Memory
PC Personal Computer
TERM Serial Port Terminal Application
XCVR Transceiver
PCB Printed Circuit Board
OTA Over the air.
SAP Service Access Point
ACK Acknowledge
AA Automatic ACK
LBT Listen Before Talk
RX Receive(r)
TX Transmit(ter)
CCA Clear Channel Assessment
ED Energy Detect
References
The following sources were referenced to produce this book:
1. Freescale MKW01 Reference Manual (MKW01xxRM.pdf)

MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 1-5
Chapter 1
MKW01 SMAC Introduction
The Freescale MKW01 Simple Media Access Controller (MKW01 SMAC) is a simple ANSI C based
codebase available as sample source code. The MKW01 SMAC is used for developing proprietary RF
transceiver applications using Freescale’s MKW01 sub-1 GHz transceiver plus microcontroller. The
MKW01 is a system-in-package (SIP) device that includes an ARM Cortex M0+ based microcontroller
and a sub-GHz ISM band radio front-end device in an LGA-56 package. Features of the MKW01 include:
• MCU has a 32-bit ARM Cortex M0+ CPU with a full set of peripheral functions
• MCU has 128KB flash and 16KB SRAM
• Full featured, programmable sub-1 GHz transceiver that supports FSK, GFSK, MSK, GMSK, and
OOK modulations schemes.
• The MKW01 has internal and external connections between the MCU and transceiver:
—The MCU communicates with the transceiver through an internally connected SPI port.
—Several transceiver status bits are also internally or externally connected to MCU GPIO and are capable
of generating interrupt requests.
NOTE
It is highly recommended the SMAC user be familiar with the MKW01
device. Additional details can be found in the device data sheet (MKW01)
and the MKW01 Reference Manual (MKW01xxRM).
The MKW01 SMAC is a small codebase that provides simple communication and test applications based
on drivers, (802.15.4 compliant) PHY and framework utilities available as source code. This environment
is useful for hardware and RF debug, hardware standards certification, and developing proprietary
applications. The MKW01 SMAC is provided as part of the Example Application Demos available for
MKW01 and also as a standalone set of files.
To use any of the existing applications available in MKW01 SMAC, users must download and open the
available Application Demos in the corresponding development environment (IDE).
SMAC features include:
• Compact footprint:
— Between 2 to 3KB of flash required, depending on configuration used.
— Less than 500 bytes RAM, depending on configuration used.
• Very low power, proprietary, bidirectional RF communication link.
• The MKW01 radio allows checking the preamble and the synchronization word, which reduces
software overhead and memory footprint.

MKW01 SMAC Introduction
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
1-6 Freescale Semiconductor
• Broadcast communication
• Unicast communication — MKW01 SMAC includes a Node Address 16-bit field. This allows
SMAC to perform unicast transmissions. To change the address of a node, modify this constant:
gNodeAddress_cinsidetheSMAC_Config.h file, orcallSMACSetShortSrcAddress(uint16_t
nwShortAddress). The address is set to 0xBEAD by default. Some of the Demo Applications
will allow the user to change this address at runtime.
• Change of current PAN. The SMAC packet uses a short 802.15.4 compliant header with a
hard-coded configuration for frame control which allows the user to switch between PANs. The
PAN address has also 16 bits (gDefaultPanID_c). This address can be modified both by changing
the default value from SMAC_Config.h file or by calling SMACSetPanID(uint16_t
nwShortPanID.
• There are no blocking functions within the MKW01 SMAC.
•Flexible enoughto configurepacket header (preamble size, synchronization word size, and synchronization
word value)
• Pre-defined settings at four different bands to initialize the SMAC protocol. The currently
supported operating frequency bands are:
— 863 – 870 MHz (Europe)
— 902 – 928 MHz (US)
— 920 – 928 MHz (Japan)
— 470 – 510 MHz (China)
• Easy-to-use sample applications included.
• Light-weight, custom LBT algorithm.
• Light-weight, custom, AA mechanism which is transparent to the user after enabling the feature.
• Encryption using Advanced Encryption Standard in Cipher Block Chaining mode, with
configurable initial vector and key.
• Configurable number of retries and backoff interval.
• Inter-layer communication using SAPs.
• The MKW01 SMAC also filters packets that have correct addressing information (pass address
filtering) but are not in the expected format (short addressing, no security, data frame).
1.1 MKW01 SMAC-based Demonstration Applications
The following is a list of MKW01 SMAC-based demonstration applications:
• PC-based Connectivity Test Application which requires a TERM. This application allows the user
to perform basic communication tests and several advanced XCVR tests.
• PC-based Wireless Messenger Application which requires a TERM and is presented in the form of
a messenger-like application. This demo application highlights the “Listen Before Talk” and
“Automatic ACK” mechanisms, allowing the user to enable, disable and configure them at
runtime.
• PC-based Wireless UART Application which requires either a TERM or an application capable of
reading/writing from/to a serial port. This application is used as a wireless UART bridge between

MKW01 SMAC Introduction
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 1-7
two or more (one to many) MKW01 platforms. It can be configured to use the previously
mentioned mechanisms, but the configuration must be done at compile time.
• PC-based Low Power Demo Application which requires a TERM. This application aids the user in
enabling low power modes on the MKW01 platforms.
1.2 Platform Requirements
The SMAC can be used with anycustomer target applicationorboard, however,Freescale provides several
development platform (modular reference board, freedom board and usb dongle) designs with leds,
pushbuttons and other modules included.
1.3 MCU Resources Used by SMAC
As stated, the MKW01 contains an MCU and a transceiver in a single package. The SMAC does not use
MCU resources directly. All accesses to the MCU resources are performed using the framework, drivers
and PHY.
1.4 SMAC Basic Initialization
Before transmitting, receiving, or performing any other SMAC operation described in this manual, the
system protocol must be initialized to configure the transceiver with correct functional settings and to set
SMAC's state machine to known states. To initialize the SMAC, perform the following tasks in order:
1. Initialize MCU interrupts and peripherals. This initialization is included in every demo in the
hardware_init(void) function, available as source code.
— Initialize LED, Keyboard, Serial Manager, Timers Manager, Memory Manager, drivers
depending on application needs.
MEM_Init();
TMR_Init();
LED_Init();
SerialManager_Init();
— Initalize PHY layer.
Phy_Init();
2. Initialize SMAC, to set the SMAC state machine to default, configure addressing with default
values, initialize the RNG used for the first sequence number value and the random backoff.
InitSmac();
3. Set the SAPhandlers so that SMAC can notifythe application on asynchronous events on both data
and management layers.
void Smac_RegisterSapHandlers(
SMAC_APP_MCPS_SapHandler_t pSMAC_APP_MCPS_SapHandler,
SMAC_APP_MLME_SapHandler_t pSMAC_APP_MLME_SapHandler,

MKW01 SMAC Introduction
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
1-8 Freescale Semiconductor
instanceId_t smacInstanceId
)
4. Reserve the RAM memory space needed by SMAC to allocate the received and transmitted OTA
messages by declaring the buffers that must be of the size gMaxSmacSDULength_c + sizeof(packet
type):
uint8_t RxDataBuffer[gMaxSmacSDULength_c + sizeof(rxPacket_t)];
rxPacket_t *RxPacket;
uint8_t TxDataBuffer[gMaxSmacSDULength_c + sizeof(txPacket_t)];
txPacket_t *TxPacket;
RxPacket = (rxPacket_t*)RxDataBuffer;
TxPacket = (txPacket_t*)TxDataBuffer;

MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 2-9
Chapter 2
Software Architecture
This chapter describes the MKW01 SMAC software architecture. All of the SMAC source code is always
included in the application. SMAC is primarily a set of utility functions or building blocks that users can
use to build simple communication applications.
2.1 Block Diagram
Figure 2-1 shows a simplified MKW01 SMAC based stack block diagram.
Figure 2-1. SMAC System Decomposition
An application programming interface (API) isimplemented in the MKW01 SMAC as a C header file (.h)
that allows access to the code. The code includes the API to specific functions. Thus, the application
interface with the SMAC is accomplished by including the SMAC_Interface.h file, which makes reference
to the required functions within the SMAC and provides the application with desired functionality.

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
2-10 Freescale Semiconductor
NOTE
MKW01 SMAC projects support only the MKW01-based target boards
designated in the files.
2.2 MKW01 SMAC Data Types and Structures
The MKW01 SMAC fundamental data types and defined structures are discussed in the following
sections.
2.2.1 Fundamental Data Types
The following list shows the fundamental data types and the naming convention used in the MKW01
SMAC:
uint8_t Unsigned 8-bit definition
uint16_t Unsigned 16-bit definition
uint32_t Unsigned 32-bit definition
int8_t Signed 8-bit definition
int16_t Signed 16-bit definition
int32_t Signed 32-bit definition
These data types are used in the MKW01 SMAC project as well as in the applications projects. They are
defined in the EmbeddedTypes.h file.
2.2.2 rxPacket_t
This structure defines the variable used for MKW01 SMAC received data buffer:
typedef struct rxPacket_tag{
uint8_t u8MaxDataLength;
rxStatus_t rxStatus;
uint8_t u8DataLength;
smacHeader_t smacHeader;
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 The MKW01 SMAC protocol data unit.
smacHeader SMAC structure that defines the header used. Freescale recommends that the user
does not modify this structure directly, but through the associated functions.

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 2-11
Usage
This data type is used by an application in the following manner:
1. Declarea buffer to store a packet to be received OTA. Freescale recommends the size of this buffer
to be at least as long as the biggest packet to be received by the application.
2. Declare a pointer of the type rxPacket_t.
3. Initialize the pointer to point to the buffer declared at the first step.
4. Initialize the u8MaxDataLength member of the packet structure. The SMAC will filter all the
received packets having a payload size bigger than u8MaxDataLength.
5. Use the pointer as the argument when calling MLMERXEnableRequest:
uint8_t RxDataBuffer[gMaxSmacSDULength_c + sizeof(rxPacket_t)];
rxPacket_t *RxPacket;
RxPacket = (rxPacket_t*)RxDataBuffer;
RxPacket->u8MaxDataLength = gMaxSmacSDULength_c;
RxEnableResult = MLMERXEnableRequest(RxPacket, 0);
You can use a variable of the type smacErrors_t to store the result of executing
MLMERXEnableRequest function.
2.2.3 smacHeader_t
This structure defines the variable used for MKW01 SMAC header:
typedef PACKED_STRUCT rxPacket_tag{
uint16_t frameControl;
uint8_t seqNo;
uint16_t panId;
uint16_t destAddr;
uint16_t srcAddr;
}rxPacket_t;
Members
frameControl Frame control configuration.The valueis set eachtimeSMACFillHeaderis called
and should not be changed.
seqNo The Sequence number is updated each time a data request is performed.
panId The value of the source and destination PAN address. It is recommended to be
changed through the associated function.
destAddr The short destination address.
srcAddr The short source address.
Usage
Freescale recommends that the user does not access this structure directly but through the associated
functions.

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
2-12 Freescale Semiconductor
2.2.4 rxStatus_t
This enumeration lists all the possible reception states:
typedef enum rxStatus_tag
{
rxInitStatus,
rxProcessingReceptionStatus_c,
rxSuccessStatus_c,
rxTimeOutStatus_c,
rxAbortedStatus_c,
rxMaxStatus_c
} rxStatus_t;
Members
rxInitStatus The RTOS based MKW01 SMAC does not use this.
rxProcessingReceptionStatus_c This state is set when the MKW01 SMAC is in the middle of receiving
a packet.
rxSuccessStatus_c This is one of the possible finish conditions for a received packet that
was successfully received and could be checked by the indication
functions.
rxTimeOutStatus_c This is another of the possible finish conditions for a timeout condition
and could be checked by the indication functions.
rxAbortedStatus_c This status is set when SMAC drops a packet (on SMAC specific
criteria) validated by PHY and the enter reception request was
performed with a timeout.
rxMaxStatus_c This element indicates the total number of possible reception states.
2.2.5 smacPdu_t
This type defines the SMAC’s basic protocol data unit:
typedef struct smacPdu_tag{
uint8_t smacPdu[1];
}smacPdu_t;
Members
smacPdu[1]. Starting position of the buffer where TX or RX data is stored.
2.2.6 txPacket_t
This structure defines the type of variable to be transmitted by the MKW01 SMAC. It is located in the
SMAC_Interface.h file and is defined as follows:
typedef struct txPacket_tag
{
uint8_t u8DataLength;
smacHeader_t smacHeader;
smacPdu_t smacPdu;

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 2-13
}txPacket_t;
Members
u8DataLength The number of bytes to transmit.
smacHeader SMAC structure that defines the header used. Freescale recommends that the user
does not modify this structure directly, but through the associated functions.
smacPdu The MKW01 SMAC protocol data unit.
Usage
This data type is used by an application in the following manner:
1. Declare a buffer to store the packet to be transmitted OTA. Freescale recommends the size of this
buffer is at least as long as the biggest packet to be transmitted by the application.
2. Declare a pointer of the type txPacket_t.
3. Initialize the pointer to point to the buffer declared at the first step.
4. Copy the desired data into the payload.
5. Set u8DataLength to the size (in bytes) of the payload.
6. Use the pointer as the argument when calling MCPSDataRequest.
uint8_t TxDataBuffer[gMaxSmacSDULength_c + sizeof(txPacket_t)];
txPacket_t *TxPacket;
...
TxPacket = (txPacket_t*)TxDataBuffer;
SMACFillHeader(&(TxPacket->smacHeader), 0xFFFF);
FLib_MemCpy(TxPacket->smacPdu.smacPdu, dataToBeSentBuffer, payloadSizeBytes);
TxPacket->u8DataLength = payloadSizeBytes;
DataRequestResult = MCPSDataRequest(TxPacket);
You can use a variable of the type smacErrors_t to store the result of executing MCPSDataRequest
function.
2.2.7 channels_t
Definition for RF channels. The number of channel varies in each defined operating band for sub-1 GHz
stacks and is fixed for the 2.4 GHz. First logical channel in all bands is 0 for sub-1GHz and 11 for 2.4 GHz.
It is defined as follows:
typedef enum channels_tag
{
#include "SMAC_Channels.h"
} channels_t;
Each application derives the minimun and maximum channel values from the enumeration above. SMAC
only keeps an enumeration of all the possible channel numbers.
Members
None

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
2-14 Freescale Semiconductor
2.2.8 smacErrors_t
This enumeration is used as the set of possible return values on most of the MKW01 SMAC API functions
and is located in the SMAC_Interface.h. Also, some of the messages sent by SMAC to the application use
this enumeration as a status.
typedef enum smacErrors_tag{
gErrorNoError_c = 0,
gErrorBusy_c,
gErrorChannelBusy_c,
gErrorNoAck_c,
gErrorOutOfRange_c,
gErrorNoResourcesAvailable_c,
gErrorNoValidCondition_c,
gErrorCorrupted_c,
gErrorMaxError_c
} smacErrors_t;
Members
gErrorNoError_c The MKW01 SMAC accepts the request and processes it. This return
value does not necessarily mean that the action requested was
successfully executed. It means only that it was accepted for processing
by the MKW01 SMAC. This value is also used as a return status in the
SMAC to application SAPs. For example, if a packet has been
succesfully sent, the message will have a data confirm field with this
status. Also, this value is returned in the CCA confirm message if the
scanned channel is found idle.
gErrorBusy_c Thisconstantis returnedwhentheMKW01 SMAClayer is not in anidle
state, and it cannot perform the requested action.
gErrorChannelBusy_c The custom “Listen Before Talk” algorithm detected a busy channel
more times than the configured number of retries. Also, a CCA confirm
message can have this value if the channel is found busy.
gErrorNoAck_c The custom “Automatic Ack” mechanism detected that no
acknowledgement packet has been received more times than the
configured number of retries.
gErrorOutOfRange_c A certain parameter configured by the application is not in the valid
range.
gErrorNoValidCondition_c Returned when requesting an action on an invalid environment.
Requesting MKW01 SMAC operations when MKW01 SMAC has not
been initialized or requesting to disable RX when SMAC was not in a
receivingor idlestate, or settinga number of retrieswithout enabling the
“LBT and AA” features.
gErrorCorrupted_c Not implemented in the RTOS based SMAC.
gErrorMaxError_c This constant indicates the total number of returned constants.

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 2-15
2.2.9 txContextConfig_t
typedef struct txContextConfig_tag
{
bool_t ccaBeforeTx;
bool_t autoAck;
uint8_t retryCountCCAFail;
uint8_t retryCountAckFail;
}txContextConfig_t;
Members
ccaBeforeTx bool_t value to enable/disable the “LBT” mechanism.
autoAck bool_t value to enable/disable the “AA” mechanism.
retryCountCCAFail This value specifies the number of times the MKW01 SMAC will
attempt to re-transmitt a packet if “LBT” is enabled and channel is found
busy.
retryCountAckFail This value specifies the number of times the MKW01 SMAC will
attempt to re-transmitt a packet if “AA” is enabled and no
acknowledgement message is received in the expected time frame.
2.2.10 smacTestMode_t
typedef enum smacTestMode_tag
{
gTestModeForceIdle_c = 0,
gTestModeContinuousTxModulated_c,
gTestModeContinuousTxUnmodulated_c,
gTestModePRBS9_c,
gTestModeContinuousRxBER_c,
gMaxTestMode_c
} smacTestMode_t;
This enumeration is used only in the Connectivity Test Application, to select the type of test to be
performed. Keep in mind that all the decisions are taken at application level and this enumeration is used
only as a reference for designing the test modes.
2.2.11 packetConfig_t
typedef struct packetConfig_tag
{
uint16_t u16PreambleSize;
uint8_t u8SyncWordSize;
uint8_t* pu8SyncWord;
} packetConfig_t;
Members
u16PreambleSize The preamble size.
u8syncWordSize The size of the synchronization word.

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
2-16 Freescale Semiconductor
pu8SyncWord Pointer to an array containing the value of the synchronization word.
Usage
Declarea variableofpacketConfig_ttype. FilltherequiredinformationandcallMLMEPacketConfig with
a pointer to the structure. Optionally, you can store the return value in a smacErrors_t variable.
Please consult the reference manual for valid lengths of preamble and synchronization word.
2.2.12 smacRFModes_t
typedef enum smacRFModes_tag
{
gRFMode1_c = gPhyMode1_c,
gRFMode2_c = gPhyMode2_c,
gRFMode3_c = gPhyMode3_c,
gRFMode4_c = gPhyMode4_c,
gRFMode5_c = gPhyMode1ARIB_c, /*ARIB mode 1*/
gRFMode6_c = gPhyMode2ARIB_c, /*ARIB mode 2*/
gRFMaxMode_c
} smacRFModes_t;
Members
gRFModeX_c With X from 1 to 4 corresponds to PHY modes 1 to 4. User must check that the
frequency band used supports the mode to be used.
gRFMode5_c This is PHY mode 1 in case the user wants to use the Japan frequency band with
ARIB mode 1.
gRFMode6_c This is PHY mode 2 in case the user wants to use the Japan frequency band with
ARIB mode 2.
Usage
Call MLMESetPhyMode with the desired enumeration member. Optionally store the return value in a
smacErrors_t variable.
2.2.13 smacEncryptionKeyIV_t
typedef struct smacEncryptionKeyIV_tag
{
uint8_t IV[16];
uint8_t KEY[16];
}smacEncryptionKeyIV_t;
Members
IV The initial vector used by the CBC mode of AES.
KEY The encryption / decryption key used by the CBC mode of AES.

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
Freescale Semiconductor 2-17
Usage
This data type is used internally by SMAC. Call SMAC_SetIVKey with two 16 byte buffer pointers as
parameters to change the SMAC initial vector and encryption key settings.
2.3 MKW01 SMAC to Application Messaging
The RTOS based SMAC communicates with the application layer in two ways: directly, through the return
value of the functions, if the request is synchronous (change channel, output power, etc) and indirectly,
through SAPs for asynchronous events (data confirm, ED/CCA confirm, data indication, timeout
indication). Both SAPs (data and management) pass information to the application using a messaging
system. The data structures used by this system are described below.
typedef enum smacMessageDefs_tag
{
gMcpsDataCnf_c,
gMcpsDataInd_c,
gMlmeCcaCnf_c,
gMlmeEdCnf_c,
gMlmeTimeoutInd_c,
gMlme_UnexpectedRadioResetInd_c,
}smacMessageDefs_t;
The above enumeration summarizes the types of messages passed through SAPs. As mentioned earlier,
there are data confirm, data indication (data layer), CCA confirm, ED confirm, timeout indication and
unexpected radio reset indication (management layer) messages. Each message type is accompanied by
corresponding message data. The main structures that build the message data are described below.
Table 2-1. Message Types and Associated Data Structures
Index Message Type Associated Data
Structures Description
1gMcpsDataCnf_c smacDataCnf_t Contains a smacErrors_t element. See
Section 2.2.8, “smacErrors_t”
2gMcpsDataInd_c smacDataInd_t u8LastRxRssi
value indicating the RSSI obtained during
the reception
pRxPacket
pointer to the packet passed as
parameter to MLMERXEnableRequest.
3gMlmeCcaCnf_c smacCcaCnf_t Contains a smacErrors_t element. See
Section 2.2.8, “smacErrors_t”

Software Architecture
MKW01 Simple Media Access Controller (SMAC) Reference Manual, Rev. 0.0
2-18 Freescale Semiconductor
All taken into consideration, the two types of messages used by the SMAC to application SAPs have the
following form:
typedef struct smacToAppMlmeMessage_tag
{
smacMessageDefs_t msgType;
uint8_t appInstanceId;
union
{
smacCcaCnf_t ccaCnf;
smacEdCnf_t edCnf;
}msgData;
} smacToAppMlmeMessage_t;
typedef struct smacToAppDataMessage_tag
{
smacMessageDefs_t msgType;
uint8_t appInstanceId;
union
{
smacDataCnf_t dataCnf;
smacDataInd_t dataInd;
}msgData;
} smacToAppDataMessage_t;
The SMAC to application SAP handlers are function pointers of a special type. When application specifies
the functions to handle asynchronous responses, the SAP handlers aquire the value of those functions.
Below are the definitions of the handlers.
typedef smacErrors_t ( * SMAC_APP_MCPS_SapHandler_t)(smacToAppDataMessage_t * pMsg,
instanceId_t instanceId);
4gMlmeEdCnf_c smacEdCnf_t status
This is a smacErrors_t element. If PHY
succesfully performs the ED it’s value will
be gErrorsNoError_c
energyLevel
The value of the energy level register.
energyLeveldB
Thevalueoftheenergylevelconvertedto
dBm.
scannedChannel
The channel number of the scanned
channel.
5gMlmeTimeoutIn
d_c
none -
6gMlme_Unexpect
edRadioResetIn
d_c
none -
Table 2-1. Message Types and Associated Data Structures
Index Message Type Associated Data
Structures Description
Table of contents
Other NXP Semiconductors IP Access Controllers manuals