How to Connect C51 Microcontroller to ATR2406 This application note describes how to control an ATR2406 with a C51 microcontroller (AT89C5130A for example). ATR2406 is a single chip RF-transceiver intended for applications in the 2.4 GHz to 2.5 GHz ISM band. 8051 Microcontrollers Application Note AT89C5131A is a high-performance Flash version of the 80C51 single-chip 8-bit microcontrollers with full speed USB functions. It is available in low pin count with 18 IOs and high pin count with 34 IOs. It also has a 32K Flash and mask ROM variants. The result is a RF/USB gateway. A wide domain of applications is proposed: – High-tech toys – Telemetry – Wireless Audio... References • AT89C5131A data sheet (available on www.atmel.com) • ATR2406 data sheet (available on www.atmel.com) Acronyms • USB: Universal Serial Bus • ISM: Industrial, Scientific and Medical (radio spectrum) 7641A–8051–05/06 ATR2406 Overview ATR2406 is a single chip RF-transceiver intended for applications in the 2.4 GHz ISM band. ATR2406 is a complete transceiver including image rejection, mixer, low IF filter, FM demodulator, RSSI, TX preamplifier, power-ramping generator for external power amplifier, integrated synthesizer, and a fully integrated VCO and TX filter. No mechanical adjustment is necessary in production. ATR2406 supports baudrates from 72kBits/s to 1152kBits/s. For 1152 kBit/s data rate, the receiver has an on-chip clock recovery function. The PLL allows two reference frequency values: – 10,368 MHz – 13,824 MHz The transceiver is programmed by the SPI (CLOCK, DATA, ENABLE). The power supply voltage range is from 2.9V to 3.6V. Figure 1. ATR2406 Block diagram 2 Connecting C51 to ATR2406 7641A–8051–05/06 Connecting C51 to ATR2406 AT89C5130 Overview AT89C5131A is a high-performance Flash version of the 80C51 single-chip 8-bit micro controllers with full speed USB functions. AT89C5131A features a full-speed USB module compatible with the USB specifications Version 1.1 and 2.0. AT89C5131A retains the features of the Atmel 80C52 with extended Flash capacity (16/32 Kbyte), 256 bytes of internal RAM, a 4-level interrupt system, two 16-bit timer/counters (T0/T1), a full duplex enhanced UART (EUART) and an on-chip oscillator. In addition, AT89C5131A has an on-chip expanded RAM of 1024 bytes (ERAM), a dualdata pointer, a 16-bit up/down Timer (T2), a Programmable Counter Array (PCA), up to 4 programmable LED current sources, a programmable hardware watchdog and a power-on reset. AT89C5131A has an hardware SPI block. A PLL provides the 48 MHz for USB from a crystal oscillator. The power supply voltage range is from 3V to 3.6V. Figure 2. Block diagram 3 7641A–8051–05/06 Hardware Connections ATR2406 has two data inputs and one output: • DATA: This input is used to program the transceiver. The programming is done by a 16 bits (or 25 bits) data word with a SPI bus (CLOCK, DATA, ENABLE). • Tx_DATA: After configuration of the transceiver, the input data on Tx_DATA are transmitted on RF. • Rx_DATA: This pin outputs the asynchronous serial data. AT89C5131A hardware SPI bus is used to configure ATR2406. AT89C5131A hardware UART is used to send/receive data to/from ATR2406. The transceiver and receiver hardware connections are identical. In the figure below, the recovery clock function pin is not connected. For the receiver, AT89C5131A starter kit is connected on USB bus. The power supply of the starter kit comes from USB (5V). The starter kit has a regulator to provide 3.3V to AT89C5131A (and ATR2406). A 3 to 5V battery is used to power the transceiver. Figure 3. AT89C5131A and ATR2406 AT89C5130A ATR2406 UART TxD Tx_DATA RxD Rx_DATA SPI P1_0 ENABLE P1_6/SCK CLOCK P1_7/MOSI DATA P1_2 nOLE P1_3 TX_ON P1_4 RX_ON P3_4 PU_REG PU_TRX REF_CLK XTAL1 4 XTAL2 Connecting C51 to ATR2406 7641A–8051–05/06 Connecting C51 to ATR2406 ATR2406 and USB Communication Problem The major issue to solve is the selection of the crystal frequency. ATR2406 allows two frequencies: – 10,368 MHz – 13,824 MHz. AT89C5131A needs a 48 MHz for the USB. The 48 MHz comes from a PLL with a prescaler multiplying the input frequency, see Figure 4. AT89C5131A prescaler cannot provide 48 MHz with 10,368 MHz or 13,824 MHz. Figure 4. AT89C5131A PLL block diagram Crystal Selection A crystal value of 13.714 MHz is selected. The crystal is provided by: • Taitien Electronic, i.e. XRFBCC-NANL, 10ppm, SMD Distributor: http://www.taitien.com AT89C5131A prescaler values are: USB clk = 13.714 * 7/2 = 48 MHz (with R=6 and N=1) ATR2406 nominal frequency of 13.824 MHz is near 13.714 MHz and the effect of changing frequency is given in section “channel description”. The results on baudrates and channels are described in the next paragraphs. Remark on Bootloader AT89C5131A default Atmel bootloader does not support the value of 7/2 for the clock prescaler. A software modification of the bootloader is needed to load a program in Flash memory with a 13.714 MHz oscillator frequency. See also, application notes for programming a customized boot loader. 5 7641A–8051–05/06 Channel Description ATR2406 operates in the 2.4 GHz to 2.5 GHz frequency band. ATR2406 proposes 95 channels without overlap in this band. Each bandwidth is equal to 800kHz (modulation deviation). There is a formula to calculate the antenna frequency in transmission mode and a formula for reception mode (from ATR2406 datasheet): TX mode: Fant = 864 kHz * (32 * SMC + SSC + 1) RX mode: Fant = 864 kHz * (32 * SMC + SSC) Table 1. Channel description in Tx mode Channel Antenna frequency (GHz) SMC SSC C0 2.401056 86 27 C1 2.401920 86 28 ....................... ....................... ....................... ....................... C93 2.482272 89 24 C94 2.482272 89 25 Table 2. Channel description in Rx mode Channel Antenna frequency (GHz) SMC SSC C0 2.401056 86 28 C1 2.401920 86 29 ....................... ....................... ....................... ....................... C93 2.482272 89 25 C94 2.482272 89 26 Figure 5. Bandwidth description 800kHz 95 channels without overlap channel 0 Fant 2.401056 GHz 6 channel 1 Fant 2.401920 GHz Frequency Connecting C51 to ATR2406 7641A–8051–05/06 Connecting C51 to ATR2406 List of Channels with 13.714 MHz Crystal Due to the 13.714 MHz frequency, the number of channels in the ISM band is limited to 79. At the 13,714 MHz frequency, the ATR2406 formula are changed to: TX mode: Fant = 857,125 kHz * (32 * SMC + SSC + 1) RX mode: Fant = 857,125 kHz * (32 * SMC + SSC) The antenna frequencies are modified and few channels are going out of the 2.4 GHz to 2.5 GHz band. Seventy nine channels are are available in this band, which is sufficient to avoid interference with other systems like Bluetooth®, and WLAN. Table 3. Channel description in Tx mode Channel Antenna frequency (GHz) SMC SSC C0 2.400807 87 16 ....................... ....................... ....................... ....................... C78 2.467662 89 30 Table 4. Channel description in Rx mode Channel Antenna frequency (GHz) SMC SSC C0 2.400807 87 17 ....................... ....................... ....................... ....................... C78 2.467662 89 31 7 7641A–8051–05/06 ATR2406 Nominal Baud Rates The ATR2406 baud rate values available with a 13.824 MHz crystal are: • 72 kBit/s (13,824 / 192) • 144 kBit/s (13,824 / 96) • 288 kBit/s (13,824 / 48) • 576 kBit/s (13,824 / 24) • 1152 kBit/s (13,824 / 12) List of Baud Rates with a 13,714 MHz Crystal The corresponding baud rate values with 13,714 MHz are: • 71,42 kBit/s (13,714 / 192) • 142,85 kBit/s (13,714 / 96) • 285,70 kBit/s (13,714 / 48) • 571,41 kBit/s (13,714 / 24) • 1142,83 kBit/s (13,714 / 12) The AT89C5131A UART formula to calculate baud rates is: 2 SMOD1 x Fclk_periph Baudrate = -----------------------------------------------------2 x 6 (1-SPD) x 16 x [256 - BRL] With a 13.714 MHz oscillator, the Fclk_periph values are: • 13.714 MHz if X2 bit = 1 • 6.857 MHz if X2 bit = 0 Table 5. Available Baud rates on AT89C5130 UART F clk_periph X2 SMOD1 SPD BRL Baud rate 6,857 MHz 0 1 1 250 71,42 kBit/s 13,714 MHz 1 1 1 244 71,42 kBit/s 6,857 MHz 0 1 1 253 142,85 kBit/s 13,714 MHz 1 1 1 250 142,85 kBit/s 13,714 MHz 1 1 1 253 285,70 kBit/s The available baud rates on AT89C5131A UART with a 13.714 MHz crystal are: • 71,42 kBit/s • 142,85 kBit/s • 285,7 kBits/s 8 Connecting C51 to ATR2406 7641A–8051–05/06 Atmel Corporation 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 487-2600 Regional Headquarters Europe Atmel Sarl Route des Arsenaux 41 Case Postale 80 CH-1705 Fribourg Switzerland Tel: (41) 26-426-5555 Fax: (41) 26-426-5500 Asia Room 1219 Chinachem Golden Plaza 77 Mody Road Tsimshatsui East Kowloon Hong Kong Tel: (852) 2721-9778 Fax: (852) 2722-1369 Japan 9F, Tonetsu Shinkawa Bldg. 1-24-8 Shinkawa Chuo-ku, Tokyo 104-0033 Japan Tel: (81) 3-3523-3551 Fax: (81) 3-3523-7581 Atmel Operations Memory 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 Microcontrollers 2325 Orchard Parkway San Jose, CA 95131, USA Tel: 1(408) 441-0311 Fax: 1(408) 436-4314 La Chantrerie BP 70602 44306 Nantes Cedex 3, France Tel: (33) 2-40-18-18-18 Fax: (33) 2-40-18-19-60 ASIC/ASSP/Smart Cards RF/Automotive Theresienstrasse 2 Postfach 3535 74025 Heilbronn, Germany Tel: (49) 71-31-67-0 Fax: (49) 71-31-67-2340 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Biometrics/Imaging/Hi-Rel MPU/ High Speed Converters/RF Datacom Avenue de Rochepleine BP 123 38521 Saint-Egreve Cedex, France Tel: (33) 4-76-58-30-00 Fax: (33) 4-76-58-34-80 Zone Industrielle 13106 Rousset Cedex, France Tel: (33) 4-42-53-60-00 Fax: (33) 4-42-53-60-01 1150 East Cheyenne Mtn. Blvd. Colorado Springs, CO 80906, USA Tel: 1(719) 576-3300 Fax: 1(719) 540-1759 Scottish Enterprise Technology Park Maxwell Building East Kilbride G75 0QR, Scotland Tel: (44) 1355-803-000 Fax: (44) 1355-242-743 Literature Requests www.atmel.com/literature Disclaimer: The information in this document is provided in connection with Atmel products. No license, express or implied, by estoppel or otherwise, to any intellectual property right is granted by this document or in connection with the sale of Atmel products. EXCEPT AS SET FORTH IN ATMEL’S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL’S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel makes no representations or warranties with respect to the accuracy or completeness of the contents of this document and reserves the right to make changes to specifications and product descriptions at any time without notice. Atmel does not make any commitment to update the information contained herein. Unless specifically providedotherwise, Atmel products are not suitable for, and shall not be used in, automotive applications. Atmel’s products are not intended, authorized, or warranted for use as components in applications intended to support or sustain life. © Atmel Corporation 2006. All rights reserved. Atmel ® , logo and combinations thereof, and Everywhere You Are ® are the trademarks or registered trademarks, of Atmel Corporation or its subsidiaries. Other terms and product names may be trademarks of others. Printed on recycled paper. 7641A–8051–05/06