FreeStar Pro SMAC Programmers’ Guide
Rev B
0006-00-08-02-000
Page 32 of 34
3.3 TRANSMITTING AN RF MESSAGE
3.3.1 More
information
See Freescale documents
“Simple Media Access Controller (SMAC) User’s Guide”
(Freescale Doc
# SMACRM) and
“MC1322x Simple Media Access Controller (SMAC) Reference Manual”
(Freescale
Doc # 22xSMACRM) for more information.
The Tx_msg structure contains a pointer to the Transmit Buffer named dataTx. These are
setup by
BeeKit™
and are declared in
generic_app.c
if using the SMAC Sample
Project contained on the CD.
Setup the size of the Message by setting the TX.msg.u8BufSize to the size of the
message.
Copy the message to transmit into the dataTx buffer using the Tx_msg structure and
pointer. For an example see the SetupRFTxMessage() function in
applications.c
.
The function is setting up a message that matches the CEL SMAC RF Protocol that is
defined in the
“ZFSM-201-EVB-1 Evaluation Board Host Serial & RF Protocol Guide”
(CEL Doc
#0006-00-08-01-000).
Initiate a request to transmit using the SMAC API MCPSDataRequest(&TX_msg). See the
RangeAppTransmit() function in
applications.c
for an example.
The (void) process_radio_msg() must be routinely called to run the radio state machine. It
is the first function called in the RangeAppTransmit() function in
applications.c
.
Before attempting to transmit or receive another RF message ensure the first message
was transmitted. Use the (s_tx_msg_final_state(TX_msg) macro to tell when the device is
done transmitting the message. This macro only looks at the end result, not what
happened. Further coding could be done by the application to track the status of the
message and verify complete success. See the RangeAppTransmit() function in
applications.c
.
3.4 RECEIVING AN RF MESSAGE
3.4.1 More
information
See Freescale documents
“Simple Media Access Controller (SMAC) User’s Guide”
(Freescale Doc
# SMACRM) and
“MC1322x Simple Media Access Controller (SMAC) Reference Manual”
(Freescale
Doc # 22xSMACRM) for more information.
The Rx_msg structure contains a pointer to the Receive Buffer named dataRx. These are
setup by
BeeKit™
and are declared in
generic_app.c
if using the SMAC Sample
Project contained on the CD.
A receive buffer size and callback function for when data is received must be setup.
These are setup by
BeeKit™
and are seen in
generic_app.c
in the main() function if
using the SMAC Sample Project contained on the CD.
Initiate a request to transmit using the SMAC API MLMERXEnableRequest(&RX_msg,
0x00000000). See the RangeAppReceive() function in
applications.c
for an example.
Use the is_rx_msg_final_state(RX_msg) macro to tell when the device is done trying to
receive a message. This macro only looks at the end result, not what happened. Further
coding could be done by the application to track the status of the receive state machine.
See RangeAppReceive() function in
applications.c
for an example.
The callback function, in the SMAC Sample Project contained on the CD, calls the void
application_rx_cb (void) if RF data is received. This function does not validate the data,
nor indicate a VALID message. It simply sets the gbDataIndicationFlag to ‘TRUE’. It is up
to the application to check this flag and validate the RF message.