AN2707 Freescale Semiconductor / Motorola, AN2707 Datasheet

no-image

AN2707

Manufacturer Part Number
AN2707
Description
Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs
Manufacturer
Freescale Semiconductor / Motorola
Datasheet
Application Note
AN2707
Rev. 0, 4/2004
Software Drivers for Tango3
RF Transmitter and Romeo2
RF Receiver ICs
By John Logan
Introduction
8/16-Bit Division
East Kilbride, Scotland
This application note describes a set of software drivers for the MC33493 RF
transmitter (codename Tango3) and the MC33591/2/3/4 RF receiver ICs
(codename Romeo2). The drivers are designed to allow a designer to quickly
develop a new application using these RF ICs with minimum effort, or to add
RF functionality to an existing design. The drivers are written in the C
programming language. The Tango3 driver can be configured to use any
HCS08 MCU. The Romeo2 driver can be configured to use any HC08 MCU
with an SPI interface. Each driver allows the user to select different MCU I/O
pins, timer channels, and clocking options, to allow easy implementation. Full
source code listings and example applications are available from Motorola's
web site at http://e-www.motorola.com.
The drivers provide the following features.
The drivers are primarily aimed at systems that use both Tango3 and Romeo2.
However, each can be used separately, if required.
This document makes frequent references to the Tango3 and Romeo2 device
datasheets; the reader should read these documents before using these
drivers. Both datasheets are available for download from Motorola's web site at
http://e-www.motorola.com.
Freescale Semiconductor, Inc.
For More Information On This Product,
Low CPU load and low MCU resource usage
Transmission/reception of variable length messages with 0–127 data
bytes
Automatic checksum based error detection for each message
Easy configuration options for carrier frequency, data rate, and other
setup parameters.
Support for networks with multiple transmitters/receivers
Go to: www.freescale.com
© Motorola, Inc., 2004

Related parts for AN2707

AN2707 Summary of contents

Page 1

... Freescale Semiconductor, Inc. Application Note AN2707 Rev. 0, 4/2004 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs By John Logan 8/16-Bit Division East Kilbride, Scotland Introduction This application note describes a set of software drivers for the MC33493 RF transmitter (codename Tango3) and the MC33591/2/3/4 RF receiver ICs (codename Romeo2) ...

Page 2

... Freescale Semiconductor, Inc. AN2707 Contents Introduction ................................................................................................................. 1 Contents ..................................................................................................................... 2 Communication Concept ............................................................................................ 3 Message Formats ....................................................................................................... 4 Sending Messages With Header Detect .............................................................. 5 Sending Messages Without Header Detect ......................................................... 5 Reducing Power Consumption ............................................................................. 6 Tone Signalling .................................................................................................... 7 Message Encoding ............................................................................................... 7 Manchester Encoding .......................................................................................... 8 Bit Decoding ......................................................................................................... 9 Tango3 Driver ............................................................................................................. 9 Tango3 Hardware Connections ........................................................................... 9 Tango3 MCU Resources .................................................................................... 11 Tango3 Driver Description ................................................................................. 12 Tango3 Driver Services ...

Page 3

... MOTOROLA Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, shows a simple example lighting network with three lighting fixtures Figure 1. Simple RF Network Go to: www.freescale.com AN2707 Communication Concept Lamp Romeo HC08 SPI receiver ...

Page 4

... Freescale Semiconductor, Inc. AN2707 Message Formats The drivers support the messaging formats defined in the Romeo2 datasheet. Communications using ID or tone signalling, with or without the header field are supported. NOTE: The Romeo2 driver uses Romeo2's on-board data manager hardware. The drivers extend the message formats shown in the datasheet, by defining length, data and checksum fields for each message ...

Page 5

... For More Information On This Product, shows a message frame transmitted by Tango3 and the received data ……… Preamble Header Length Data0 ……… Length Data0 Go to: www.freescale.com AN2707 Message Formats Data127 Checksum EOM Data127 Checksum SPI output (Romeo2 to MCU) (the number of repeats is 5 ...

Page 6

... Freescale Semiconductor, Inc. AN2707 it will pass all following data to the MCU via the SPI interface. See the ID field is repeated, this will mean that ID bytes are also passed to the MCU. This message format requires more CPU time to decode the received data, since it must handle the ID field. ...

Page 7

... Data0 shows the flow of data and the encoding stages for a message Go to: www.freescale.com Message Formats ……… Data0 Data7 Checksum EOM Strobe pin level ……… Data127 Checksum EOM ……… Data127 Checksum SPI output (Romeo2 to MCU) AN2707 7 ...

Page 8

... Freescale Semiconductor, Inc. AN2707 (FSK) modulation or On/Off Keying (OOK) modulation. Romeo2 receives the FSK/OOK signal, removes the Manchester encoding and passes the message to the software driver via the SPI interface. The software driver writes the message to a RAM buffer where the CPU can read the message. The Romeo2 driver must be correctly configured to match the message format, data rate and RF carrier frequency used by the Tango3 transmitter ...

Page 9

... It transmits decoded bits on its SPI interface. Tango3 Driver Tango3 Hardware Figure 8 Connections MOTOROLA Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product shows the interface between the Tango3 IC and an MCU. Go to: www.freescale.com AN2707 Tango3 Driver Timer counter Value 9 ...

Page 10

... Freescale Semiconductor, Inc. AN2707 Timer channel I/O pin MCU Timer clk in Required Optional A description of each connection between the MCU and Tango3 is given below. DATA — The data to be transmitted over the RF link is passed to Tango3 on this line encoded using Manchester encoding, as defined in the Tango3 datasheet compatible with Romeo2's data manager ...

Page 11

... One timer channel configured as a clock input and connected to Tango3's DATACLK pin. (Some HC08 MCUs allow a timer pin to be used as a clock input source.) This allows Tango3 to provide the MCU with an accurate clock source, which can be used by the MCU to Go to: www.freescale.com AN2707 Tango3 Driver 11 ...

Page 12

... Freescale Semiconductor, Inc. AN2707 • • • Tango3 Driver This section provides a description of the Tango3 driver application interface Description and run-time services. The Tango3 driver provides a set of runtime services using C function calls that allow the user to transmit messages. The services are listed below. ...

Page 13

... Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, Figure 9. Note storage for the checksum field is not TANGO_MAX_DATA_SIZE on page 22 TangoDriverStatus on page $xxxx ID Length Data0 ... ... ... Data127 Figure 9. Tango3 Transmission Buffer Go to: www.freescale.com AN2707 Tango3 Driver for details. 18. 0 Adding 27. 13 ...

Page 14

... Freescale Semiconductor, Inc. AN2707 Start Start Call TangoInitialise to Call TangoInitialise to initilise driver initilise driver Call TangoEnable to Call TangoEnable to power up Tango3 power up Tango3 Set a variable IdRepeat to number Set a variable IdRepeat to number of times ID+Preamble will be sent of times ID+Preamble will be sent Put message in transmit buffer ...

Page 15

... With correct number of ID repeats N N Driver status Driver status == == TANGO_READY? TANGO_READY Want to send Want to send another message ? another message ? Call TangoDisable Call TangoDisable End End Figure 11. Sending a Message Without a Header Field Go to: www.freescale.com AN2707 Tango3 Driver ...

Page 16

... Freescale Semiconductor, Inc. AN2707 After the driver has been initialized, it can be in one of four states. TANGO_DISABLED — Driver disabled, Tango3 IC is powered down TANGO_READY — Driver enabled, Tango3 IC is powered up and ready to send data TANGO_IN_ENABLE_DELAY — Driver enabled, Tango3 is currently powering up and is not available to send messages TANGO_BUSY — ...

Page 17

... Tango3 IC. During the 2 ms timeout it can load a message into the transmit buffer and call the TangoStatus service to check if the 2 ms timeout has finished. When TangoStatus returns the value TANGO_READY, the application is ready to transmit the message. Go to: www.freescale.com AN2707 Tango3 Driver 17 ...

Page 18

... Freescale Semiconductor, Inc. AN2707 TangoDisable Syntax: Parameters: Return: Description: Notes: TangoDriverStatus Syntax: Parameters: Return: Description: Notes: 18 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, void TangoDisable(void); None None The TangoDisable service sets the driver status to TANGO_DISABLED and powers down the Tango3 IC ...

Page 19

... Sending Messages With Header Detect on page 5. The service should be called only when the Romeo2 configured to detect Header bytes in a message sequence (i.e., the option ROMEO_HE_VALUE is set the Romeo.h header file). Go to: www.freescale.com AN2707 Tango3 Driver 5. 19 ...

Page 20

... Freescale Semiconductor, Inc. AN2707 TangoSendMessageNoHeader Syntax: Parameters: Returns: Description: Notes: TangoTimerInterrupt Syntax: Parameters: Description: Tango3 Driver The Tango3 driver has a static configuration at compile time. Its configuration Configuration cannot be changed during run time. The driver configuration is defined in a header file Tango.H. Configuration options are available for the following. ...

Page 21

... HCS08 MCUs have the same layout of control registers. The driver uses this base address to access the timer control registers. Address in range 0x0000 - 0xffff This defines the timer channel used to output data on the DATA line. Channel number in the range 0–15 Use timer channel to: www.freescale.com AN2707 Tango3 Driver 21 ...

Page 22

... Freescale Semiconductor, Inc. AN2707 TANGO_MAX_DATA_SIZE Description: Values: Example: #define TANGO_MAX_DATA_SIZE TANGO_TIMER_CLOCK_SOURCE Description: Values: Example: #define TANGO_TIMER_CLOCK_SOURCE TANGO_TIMER_CLOCK_SPEED Description: Values: Example: #define TANGO_TIMER_CLOCK_SPEED 22 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, This defines the maximum number of data bytes that can be transferred ...

Page 23

... Timer remains running after transmission of data Timer is disabled after transmission of data. This defines the type of modulation used in RF transmissions: On Off Keying (TANGO_OOK) or Frequency Shift Keying (TANGO_FSK). TANGO_OOK denotes OOK modulation. TANGO_FSK denotes FSK modulation. TANGO_MODE_VALUE TANGO_OOK Go to: www.freescale.com AN2707 Tango3 Driver /* OOK modulation ...

Page 24

... Freescale Semiconductor, Inc. AN2707 TANGO_BAND_VALUE Description: Values: Example: #define TANGO_BAND_VALUE TANGO_CRYSTAL_FREQUENCY Description: Values: Example: #define TANGO_CRYSTAL_FREQUENCY 13560000 TANGO_DATA_RATE Description: Values: Example: #define TANGO_DATA_RATE 24 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, This defines if Tango3 is used in high band or low band configuration ...

Page 25

... Tango3's Enable pin. If Enable is not controlled by the MCU in your system, delete this #define from the header file. Any I/O pin configurable as an output can be used. Use the naming convention specified in the CodeWarrior header files. PTADD_PTADD0 /* DDR for Port A pin 0 Go to: www.freescale.com AN2707 Tango3 Driver */ */ 25 ...

Page 26

... Freescale Semiconductor, Inc. AN2707 TANGO_MODE Description: Values: Example: #define TANGO_MODE TANGO_MODE_DDR Description: Values: Example: #define TANGO_MODE_DDR TANGO_BAND Description: Values: Example: #define TANGO_BAND 26 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, This defines the I/O pin used to control Tango3's MODE pin ...

Page 27

... Tango3 files included is a screenshot of the project parameter file showing how to include shows an example Tango.H header file. This has been configured Go to: www.freescale.com AN2707 Adding the Tango3 Driver to an Application /* DDR for PortA pin 2 */ ...

Page 28

... Freescale Semiconductor, Inc. AN2707 Figure 13. Application Template with Tango3 Files Included 28 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, TangoTransmitBuffer[] Tango.H file declaration Tango.H and Tango.C added to project Go to: www.freescale.com MOTOROLA ...

Page 29

... Freescale Semiconductor, Inc. MOTOROLA Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, TangoTimerInterrupt entry Figure 14. Project Parameter File Go to: www.freescale.com AN2707 Adding the Tango3 Driver to an Application 29 ...

Page 30

... Freescale Semiconductor, Inc. AN2707 /****************************************************************************************/ /* THIS SECTION CONTAINS VALUES YOU MUST DEFINE! /* #include <MC9S08GB60.h> #define TANGO_TIMER_ADDRESS #define TANGO_TIMER_CHANNEL #define TANGO_MAX_DATA_SIZE 127 #define TANGO_MODE_VALUE TANGO_OOK #define TANGO_TIMER_CLOCK_SPEED #define TANGO_TIMER_CLOCK_SOURCE #define TANGO_CRYSTAL_FREQUENCY #define TANGO_TIMER_PRESCALE #define TANGO_TIMER_DISABLE #define TANGO_BAND_VALUE #define TANGO_DATA_RATE #define TANGO_ENABLE #define TANGO_ENABLE_DDR ...

Page 31

... Tango3 to start. Sending Messages With Header Detect on page 5 Messages Without Header Detect on page shows a simple application that will send a continuous stream of shows the contents of the Tango.h file for this example. Go to: www.freescale.com AN2707 Using the Tango3 Driver in an Application and Sending 5. 31 ...

Page 32

... Freescale Semiconductor, Inc. AN2707 Figure 16. Example Tango3 Application. 32 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, Go to: www.freescale.com MOTOROLA ...

Page 33

... Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, shows the interface between the Romeo2 IC and an MCU. STROBE RESETB RESETB SCLK SCLK MOSI MOSI MISO MISO Figure 17. Romeo2 Interface to MCU Go to: www.freescale.com AN2707 Romeo2 Driver MCU SCLK MOSI MISO SS 33 ...

Page 34

... Freescale Semiconductor, Inc. AN2707 Romeo2 Driver This section provides a description of the Romeo2 driver application interface Description and run-time services. The Romeo2 driver provides a set of runtime services using C function calls that allow the user to receive messages. The services are listed below. RomeoInitialise — Configure the Romeo2 driver (must be called when MCU resets) RomeoEnable — ...

Page 35

... Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product $xxxx BF Length Data0 ... ... ... Data127 Figure 18. Romeo2 Receive Buffer shows a flowchart for configuring the driver to receive messages. shows the various states the driver will return, when the Go to: www.freescale.com AN2707 Romeo2 Driver 0 46. 35 ...

Page 36

... Freescale Semiconductor, Inc. AN2707 Figure 19. Configuring the Driver to Receive Messages 36 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, Start Start Call Call RomeoInitialise RomeoInitialise Call Call RomeoEnable to enable RomeoEnable to enable driver for reception driver for reception ...

Page 37

... Msg received Msg received flag cleared flag cleared ROMEO_CHECKSUM_ERROR ROMEO_CHECKSUM_ERROR ROMEO_MSG_READY ROMEO_MSG_READY Msg received with Msg received with checksum error checksum error Go to: www.freescale.com AN2707 Romeo2 Driver Buffer Full Buffer Full flag cleared flag cleared Call Call RomeoDisable() RomeoDisable() Call Call RomeoDisable() ...

Page 38

... Freescale Semiconductor, Inc. AN2707 Romeo2 Driver This section provides descriptions of each service provided by the Romeo2 Services driver. RomeoInitialise Syntax: Parameters: Return: Description: Notes: RomeoEnable Syntax: Parameters: Return: Description: 38 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, void RomeoInitialise(void) ...

Page 39

... ROMEO_CHECKSUM_ERROR — driver enabled, last message received has a checksum error • ROMEO_NO_MSG — driver enabled, no messages waiting The RomeoStatus service returns the current state of the Romeo2 driver. Go to: www.freescale.com AN2707 Romeo2 Driver 39 ...

Page 40

... Freescale Semiconductor, Inc. AN2707 RomeoStrobeHigh Syntax: Parameters: Returns: Description: RomeoStrobeLow Syntax: Parameters: Returns: Description: RomeoStrobeTriState Syntax: Parameters: Returns: Description: 40 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, void RomeoStrobeHigh(void); None None The RomeoStrobeHigh service sets the Strobe pin (if under driver control) to logic 1 ...

Page 41

... CodeWarrior parameter file, the SPI interrupt vector must be directed to this function. This function MUST be included to ensure proper operation of the software driver. Message format Message data rate Message modulation format (OOK or FSK) Carrier frequency Strobe oscillator function MCU resources Go to: www.freescale.com AN2707 Romeo2 Driver 41 ...

Page 42

... Freescale Semiconductor, Inc. AN2707 These configuration options are set using a number of #define statements in the Romeo.h header file. Using these #defines, the driver can be configured to run on any HC08 MCU with an SPI interface. When starting a new project using the Romeo2 driver, you should place files ‘ ...

Page 43

... CodeWarrior header files. PTA_PTA0 This defines the modulation type used in RF transmissions - ON/OFF Keying (ROMEO_OOK) or Frequency Shift Keying (ROMEO_FSK) ROMEO_OOK = OOK modulation ROMEO_FSK = FSK modulation ROMEO_OOK /* Go to: www.freescale.com AN2707 Romeo2 Driver */ /* DDRA for Port A pin 0 */ OOK modulation */ 43 ...

Page 44

... Freescale Semiconductor, Inc. AN2707 ROMEO_BAND_VALUE Description: Values: Example: #define ROMEO_BAND_VALUE ROMEO_SOE_VALUE Description: Values: Example: #define ROMEO_SOE_VALUE ROMEO_HE_VALUE Description: Values: Example: #define ROMEO_HE_VALUE ROMEO_ID_VALUE Description: Values: Example: #define ROMEO_ID_VALUE 44 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, This defines if Romeo2 is used in high band or low band configuration ...

Page 45

... This defines the data rate of received messages before Manchester encoding 0 = 1.0 - 1.4kbaud 1 = 2.0 - 2.7kbaud 2 = 4.0 - 5.3kbaud 3 = 8.6 - 10.6kbaud 0 /* Datt in range 1.0 - 1.4 kbaud */ Go to: www.freescale.com AN2707 Romeo2 Driver /* Sleep time RUN time */ 45 ...

Page 46

... Freescale Semiconductor, Inc. AN2707 ROMEO_MG_VALUE Description: Values: Example: #define ROMEO_MG_VALUE ROMEO_MS_VALUE Description: Values: Example: #define ROMEO_MS_VALUE ROMEO_PG_VALUE Description: Values: Example: #define ROMEO_PG_VALUE Adding the Romeo2 Driver to an Application To add the Romeo2 driver to an application: 1. Add Romeo.h and Romeo.c files to project (in CodeWarrior, right click 2. Add line #include ‘ ...

Page 47

... CodeWarrior application template, with Romeo2 is a screenshot of the project parameter file showing how to include shows an example Romeo.H header file. This has been configured RomeoReceiveBuffer[] declaration Romeo.H header file Romeo.C and Romeo.H files added to project Go to: www.freescale.com AN2707 Adding the Romeo2 Driver to an Application 47 ...

Page 48

... Freescale Semiconductor, Inc. AN2707 48 Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, RomeoSPIRxInt entry Figure 22. Project Parameter File Go to: www.freescale.com MOTOROLA ...

Page 49

... If hardwired,delete #defines PTG_PTG3 /* #defines for AGC pin DDRG_DDRG3 /* If hardwired,delete #defines -> slow, OOK /* 0 -> fast, FSK PTG_PTG2 /* #defines for LNA pin /* If hardwired,delete #defines Figure 23. Example Romeo.h File Go to: www.freescale.com AN2707 Adding the Romeo2 Driver to an Application */ */ */ */ */ */ */ */ */ */ */ ...

Page 50

... Freescale Semiconductor, Inc. AN2707 Using the Romeo2 Driver in an Application 1. The application must first call RomeoInitialise() to configure the driver 2. The application must then call RomeoEnable() to enable the Romeo2 IC 3. After RomeoEnable() has been called, the application should poll the 4. After a message has been read from the receive buffer, the Buffer Full Figure 24 messages ...

Page 51

... Software Drivers for Tango3 RF Transmitter and Romeo2 RF Receiver ICs For More Information On This Product, Motorola and the Motorola logo are registered trademarks of Motorola, Inc. ® CodeWarrior is a registered trademark of MetroWerks, a wholly owned subsidiary of Motorola, Inc. Go to: www.freescale.com AN2707 Using the Romeo2 Driver in an Application 51 ...

Page 52

... Motorola and the Stylized M Logo are registered in the U.S. Patent and Trademark Office. digital dna is a trademark of Motorola, Inc. All other product or service names are the property of their respective owners. Motorola, Inc Equal Opportunity/Affirmative Action Employer. © Motorola, Inc. 2004 AN2707 Go to: www.freescale.com ...

Related keywords