NXP Semiconductors SMAC Скачать руководство пользователя страница 8

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

Страница 1: ...Document Number SMAC08RM Rev 2 0 03 2012 Simple Media Access Controller SMAC for the HCS08 Reference Manual ...

Страница 2: ...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 ac...

Страница 3: ... 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_...

Страница 4: ...etClockRate 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 ...

Страница 5: ...s 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 ...

Страница 6: ...rcuit 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 additiona...

Страница 7: ...s 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...

Страница 8: ...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 comm...

Страница 9: ...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 projec...

Страница 10: ...ojects 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 usin...

Страница 11: ...agram 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 specif...

Страница 12: ...ion 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 Wizar...

Страница 13: ...Pdu 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 t...

Страница 14: ...ion 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 typ...

Страница 15: ...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 transmi...

Страница 16: ...ge_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 gMaxSc...

Страница 17: ...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 b...

Страница 18: ...eBase16p625kHz_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 fo...

Страница 19: ...edia 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 ...

Страница 20: ...Software Architecture Simple Media Access Controller SMAC for the HCS08 Reference Manual Rev 2 0 2 10 Freescale Semiconductor ...

Страница 21: ...synchronous function which means that the function does not run in the same thread as the caller the application It asks SMAC to transmit a packet and returns control to the application when transmission is completed the result of the operation is reported by the MCPSDataConfirm callback which is called in an interrupt context Prototype smacErrors_t MCPSDataRequest txPacket_t Arguments txPacket_t ...

Страница 22: ...ve measure of the strength or quality of a received packet A value called a Link Quality Indicator LQI is returned by the transceiver as a result of a received packet This function returns an integer byte value for the link quality that is valid for the last received packet This binary value can be translated into a measurement of received signal strength in dBm via the equation dBm Link Quality 7...

Страница 23: ...n anticipation of receiving a data packet The receiver is enabled on the channel previously selected by MLMESetChannelRequest The function call passes an argument that sets a timeout value for the receive mode The argument is a 32 bit value however the maximum value is 0x00FFFFFF The total time period equals value x transceiver timer clock period The timer clock period is determined by the frequen...

Страница 24: ...data packet is received or the MLMERXDisableRequest function is called To turn off the receiver before a valid packet is received the MLMERXDisableRequest call can be used 3 1 5 MLMEDozeRequest The transceiver has low power modes with the reference oscillator disabled Hibernate or enabled Doze The Doze request function allows the user to put the radio either in Normal Doze Mode without CLKO but wi...

Страница 25: ...as parameter Then the SMAC sets the radio in Acoma Mode with CLKO Output MLMEWakeRequest To exit from this state users should call the MLMEWakeRequest function To use Normal Doze Mode users should call this function with the desired timeout When the SMAC places the radio in Doze Mode the user is given 128 CLKO clock cycles more before disabling CLKO if the MCU is using this signal as a clock sourc...

Страница 26: ...the energy on the current channel Usage The function is simply called The returned value is the energy detected on the presently selected channel NOTE SMAC provides the MLMEScanRequest function as the default means to do energy detect or a CCA function across multiple channels However the transceiver is also capable doing a single CCA cycle instead of a simple ED see the appropriate device referen...

Страница 27: ... binary value for the offset adjust Returns gErrorNoError_c The power compensation value have been set on the radio Usage Use a standard offset value of 0x9B Use MLMEFEGainAdjust to increase or decrease the offset 3 1 8 MLMEGetChannelRequest The IEEE 802 15 4 Standard supports 16 set channels frequencies This function returns the current active channel If the current frequency setting does not mat...

Страница 28: ...1323x platform devices It only returns gErrorNoError_c Prototype smacErrors_t MLMEHibernateRequest void Arguments None Returns gErrorNoError_c The Radio has been set in Hibernate mode gErrorBusy_c Radio is performing another action and could not attend this request Usage When function is called the reference oscillator is disabled and CLKO if enabled is disabled after 128 clock cycles similar to D...

Страница 29: ...is called to perform a soft reset to the transceiver for all families This function restarts PHY and SMAC states machines Prototype smacErrors_t MLMEPHYSoftReset void Arguments None Returns gErrorNoError_c If the action was performed Usage Simply call the MLMEPHYSoftReset function directly Table 3 1 U8PaValue vs MC13202 and MC13213 TX Power Out U8PaValue Typical Differential Power at Output Contac...

Страница 30: ...one Returns gErrorNoError_c Radio initialization was performed successfully gErrorNoResourcesAvailable_cRadio initialization couldn t be performed Usage Simply call the MLMERadioInit function directly NOTE Not executing this function could cause many SMAC API functions to return gErrorNoValidCondition_c error code If user wishes to change initialization parameters they must be changes within the f...

Страница 31: ...ernal clock source for the MCU This function is called to set the desired CLKO output frequency The CLKO frequency is divided down from the reference oscillator frequency of 16 MHz NOTE This primitive can be used only on the MC1320x and MC1321x platforms For the MC1323x platform it is invalid Prototype smacErrors_t MLMESetClockRate clkoFrequency_t Arguments clkoFrequency_t An 8 bit value that sets...

Страница 32: ...timerTimeBase_t Arguments timerTimeBase_t Enumeration value that represents that represents timer prescale or timebase Returns gErrorNoError_c If the action is performed gErrorOutOfRange_c If TimeBase exceeds the maximum valid value Usage Call MLMESetTmrPrescale gTimeBase2MHz_c gTimeBase16p625kHz_c NOTE Valid values for this primitive depend on the platform been used There are two sets of primitiv...

Страница 33: ...uest The device transceiver can be put into low power mode using the MLMEDozeRequest or MLMEHibernateRequest functions The MLMEWakeRequest function can be called to wake up the transceiver NOTE This primitive can be used only on the MC1320x and MC1321x platforms For the MC1323x platform it is invalid Prototype smacErrors_t MLMEWakeRequest void Arguments None Returns gErrorNoError_c If the action i...

Страница 34: ...anual for proper trim values Prototype smacErrors_t MLMEPHYXtalAdjust uint8_t Arguments uint8_t An 8 bit value representing the trim value to the oscillator Returns gErrorNoError_c If the action is performed gErrorOutOfRange_c If TrimValue exceeds the maximum trim value Usage Simply call the MLMEPHYXtalAdjust Desired trim value function directly 3 1 18 XCVRContReset For the MC1319x MC1320x and MC1...

Страница 35: ...platform it is invalid Prototype void XCVRRestart void Arguments None Returns Nothing Usage Call this function to release the transceiver hardware reset The transceiver should be re initialized after a reset 3 1 20 MLMEGetPromiscuousMode As standard practice SMAC allows the receiver function to filter incoming RX packets allowing only SMAC compatible packets to be recognized see Section 3 1 23 MLM...

Страница 36: ...uffer where the version will be written Returns gErrorNoError_c If the action is performed gFailOutOfRange_c If the requested Entity is not part of the stored ones Usage Call this function to determine the current IC Hardware version or the SMAC Software stack version 3 1 22 MLMEScanRequest A useful function is to be able to scan the different frequency channels and report the status of reported e...

Страница 37: ...ed technique and a buffer of 16 elements When gScanModeCCA_c is used a CCA 802 15 4 scan is performed CCA Mode 1 is implemented by default which means that it only checks for energy above a threshold The default CCA Threshold is 0x80 This threshold is initialized at PHY level CCA returns FALSE if the channel was found idle and TRUE if the channel was busy For gScanModeED_c the individual channel e...

Страница 38: ...et SMAC s promiscuous mode 3 1 24 MLMETestMode For evaluating RF circuitry and doing certification testing radio test modes are required The MLMETestMode function enables a number of radio tests These include the following PRBS9 Mode Repeatedly sends out a 64 byte packet using a PRBS9 algorithm All packets that are transmitted in this mode are identical The data is produced by the function call Fo...

Страница 39: ...the radio to back to the original IDLE mode gTestModeContinuousRx_c Sets the radio into continuous RX mode gTestModeContinuousTxModulated_cSets the device to continuously transmit a 10101010 pattern gTestModeContinuousTxUnmodulated_cSets the device to continuously transmit an unmodulated CW 3 1 25 SMACDisableInterrupts This function is called to disable the interrupts that are used by SMAC concern...

Страница 40: ...rm This function is executed when a transmission operation finishes this is a callback function that the application should implement Prototype void MCPSDataComfirm txStatus_t Arguments txStatus_t This indicates the status of the transmission operation Returns Nothing Usage This callback function must be executed once a transmission operation is completed successful or not Use txStatus_t argument ...

Страница 41: ...e the rxStatus element of rxPacket_t structure to define the application execution path NOTE This function is executed as part of an interrupt service routine as a result follow all the recommendations for interrupt execution timing and context 3 1 29 MLMEResetIndication This function is executed after a reset has been commanded and when the transceiver indicates the reset has finished Prototype v...

Страница 42: ...Nothing Usage Use this function to acknowledge that the scan operation has finished and the scan stored values are valid NOTE This function is executed as part of an interrupt service routine as a result follow all the recommendations for interrupt execution timing and context 3 1 31 MLMEWakeComfirm This function is executed after Wake operation has finished Prototype void MLMEWakeComfirm void Arg...

Отзывы: