NXP Semiconductors SMAC Reference Manual Download Page 34

Primitives

Simple Media Access Controller (SMAC) for the HCS08 Reference Manual, Rev. 2.0

3-14

Freescale Semiconductor

 

The MC13202 and MC1321x devices have a 16 MHz reference oscillator. In the transceiver there 
is a register with an 8-bit “xtal_trim[7:0]” field that can be programmed to set the trim value

The MC1323x devices have a 32 MHz reference oscillator. The 8-bit trim register is called 
XTAL1_TRIN[7:0] and can be programmed to set the trim value.

The use of the 8-bit trim field differs between device types. The user is referred to the appropriate family 
device Reference Manual 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 MC1321x platforms the MCU controls and asserts the transceiver 
hardware reset. This function asserts and holds the reset line of the transceiver; shutting it down and 
holding it in its lowest power mode.

NOTE

This primitive can be used only on the MC1320x and MC1321x platforms. 
For the MC1323x platform, it is invalid.

Prototype

void XCVRContReset(void);

Arguments

None

Returns

Nothing

Summary of Contents for SMAC

Page 1: ...Document Number SMAC08RM Rev 2 0 03 2012 Simple Media Access Controller SMAC for the HCS08 Reference Manual ...

Page 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...

Page 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_...

Page 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 ...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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 ...

Page 20: ...Software Architecture Simple Media Access Controller SMAC for the HCS08 Reference Manual Rev 2 0 2 10 Freescale Semiconductor ...

Page 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 ...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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 ...

Page 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...

Page 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...

Reviews: