279d13135560533ed53f948e342dffd8.ppt
- Количество слайдов: 30
Studienarbeit Vortrag Wireless Communication Von Spisa Yang Liu(215622) 30. 11. 2005
Einleitung n Digital Signal Controller(dspic 30 F 3013) n n Radio Frequenz Funkmodule n n n I/O Ports UART SPI n. RF 905 Transceiver Steuerungsregister Transmit and Receive Komplete Module Interface Anwendungsbeispiel
dspic 30 F 3013 I/O Ports n TRISx: Data Direction Register n n PORTx: I/O Port Register n n n Read: Value of the I/O Pin Write: To Port Data Latch LATx: I/O Latch Register n n n 1: Input, 0: Output Read: Value in Port Data Latch Write: To Port Data Latch ADPCFGx: ADC Port Configuration Register (Port B) n 1: Digital I/O, 0: Analog I/O
Universal Asynchronous Receiver Transmitter(UART) n n n n n Full-Duplex 8 - or 9 Bit Data Transmission Even, Odd or No Parity One or Two Stop Bits Fully Integrated Baud Rate Generator 16 Bit Prescaler Baud Rate 29 bps to 1. 875 Mbps 4 Deep FIFO Transmit Data Buffer 4 Deep FIFO Receive Data Buffer Error Detection 9 Bit Mode with Address Detection Transmit Receive Interrupt
UART Register n Control Register: Ux. Mode n n Status and Control Register: Ux. STA n n Example: unsigned char c = U 1 RXREG; Transmit Register: Ux. TXREG n n Transmit Enable, Address Detect Mode, Error Detection, Buffer Overflow, Transmit Buffer Full… Receive Register: Ux. RXREG n n Enable, Alterative IO Pins, Parity Data Selection… Example: U 1 TXREG = ‘c’; Baud Rate Generator: Ux. BRG
UART Register Example: Quarze: 20 MHz Baud. Rate: 57. 6 Kbps Ux. REG = 4. 42=4 Real Baud. Rate: 62. 5 Kbps Error: 8. 5%>3% Quarze: 22. 1184 MHz Baud. Rate: 57. 6 Kbps Ux. REG = 5 Error: 0%
Serial Peripheral Interface(SPI) n n n Synchronous Serial Interface communicate with other Peripheral or Microcontroller Serial EEPROMs, Shift Register, Display Drivers, ADCs, n. RF 905 SPI Interface consist of 4 Pins n n SDIx: Serial Data Input SDOx: Serial Data Output SCKx: Shift Clock Input or Output SSx: Active low Slave Select or Frame Synchronization I/O Pulse
SPI Register n SPI Status and Control Register: SPIx. STAT n n SPI Enable, SPI Transmit Buffer Full Status, SPI Receive Buffer Full Status SPI Control Register: SPIx. CON n n Framed SPI Support, 8 -Bit or 16 -Bit Select, Master or Slave Select Secondary and Primary Prescale Bits Bit Rate from Fcy to Fcy/512
SPI Master Mode Operation
Radio Frequenz Funkmodule n Single Chip Transceiver n. RF 905 n n n 433 MHz, 868 MHz, 915 MHz ISM Band GFSK Transceiver Betriebspannung 1. 9 v-3. 6 v Bis 50 Kbps Multikanäle Senderleistung – 10 d. Bm--10 d. Bm Carrier Detection Adress Match von Packet 8 -Bit, 16 -Bit CRC Codierung Manchester Codierung 5 x 5 mm 32 Pin QFN Package
n. RF 905 Blockschaltbild
n. RF 905 Register
n. RF 905 Instruction
n. RF 905 Configuration Register
n. RF 905 Configuration Register n n CH_NO, 9 Bits: Frequenz Einstellen Freq = (422. 4+CH_NO/10)*(1+HFREQ_PLL)MHz Beispiel: Freq = 433 MHz CH_NO=0 x 04 c=0 b 001001100 HFREQ_PLL, 1 Bit: Frequenz Einstellen 0: 433 MHz Band, 1: 868 MHz oder 915 Mhz Band PA_PWR, 2 Bits: Sendleistung Einstellen -10 d. Bm, -2 d. Bm, 6 d. Bm, 10 d. Bm RX_AWF, TX_AWF, 3 Bits: Adressenbereit 001: 1 Byte …… 100: 4 Byte
n. RF 905 Configuration Register n n n RX_PW, TX_PW, 6 Bits: Payload Bereit 000001: 1 Byte…… 100000: 32 Byte RX_ADDRESS, 4 Byte: Receiver Adresse XOF, 3 Bits: Oszillator Frequenz 4 MHz, 8 MHz, 12 MHz, 20 MHz 011: 16 MHz CRC_EN 1 Bit: CRC Codierung Enable 0: Disable, 1: Enable CRC_MODE 1 Bit: CRC Codierung Mode 0: 8 Bit Mode, 1: 16 Bit Mode
n. RF 905 Register and Control n n TX_ADDRESS, 4 Byte: Send Address TX_PAYLOAD, 32 Byte: Send Data RX_PAYLOAD, 32 Byte: Receive Data STATUS_REGISTER, 1 Byte: n AM, DR
n. RF 905 Receive Standby Mode PWR_UP = HI TX_EN = LO TRX_CE = HI Carrier Detect Set CD High Correct Address? yes no Correct CRC? no yes Set AM LO Set DR and AM LO Read Data in RX_PAYLOAD Via SPI Set DR HI
n. RF 905 Transmit Standby Mode PWR_UP = HI TX_EN = HI TRX_CE = LO SPI Programming Load TX_ADDRESS and TX_PAYLOAD TRX_EN = HI? Transmitter is yes Powered up no yes no TRX_EN = HI? Preamble 10 Bits Address To 4 Bytes Generate Preamble and CRC, Send Package Set DR Hi when Finish Maximal 1 ms Data To 32 Bytes CRC 0, 1 or 2 Byte
Wireless Communication Interface unsigned unsigned char char NRFConfig[10]; RX_ADDRESS[4]; TX_ADDRESS[4]; Spi. Rx. Buf[32]; Spi. Tx. Buf[32]; // Configuration Bytes // Speicherplatz RX Address // Speicherplatz TX Address // Speicherplatz Receive Data // Speicherplatz Send Data void Set. NRFRegister(unsigned char CBit, unsigned char Register[], unsigned char Counter); // n. RF 905 Konfigurieren void Set. Tx. Mode(void); // Set TX Mode void Set. Rx. Mode(void); // Set RX Mode void TXPackage(void); // Send Data Package void RXPackage(void); // Receive Data Package
Komplete Schaltung 433 MHz
Funkmodule PCB 433 MHz
Anwendungsbeispiel n Aufgabe: Ein String(bis 512 Byte) von einem PC nach ander PC Schicken. PC 1 Max 232 dspic Funk Module PC 2 Max 232 dspic Funk Module
Schaltplan
Protokoll n Kommunikation zwischen PC und dspic durch UART byte 0 CMD TA 1 TA 2 TA 3 TA 4 DT MP 1 byte 8 byte 9 byte 521 MP 2 LL Data …… Data • CMD: Command Byte, 0 x 00 für String Schicken • TA 1 -TA 4: TX Address • DT: Datatyp (Char, Int, Float, Double. . . ) • MP 1, MP 2: Maxmale Package Number int Max. Pack. Nr = (MP 1<<8)+MP 2; • LL: Last Package Length int Datalength = (Max. Pack. Nr-1)*29 + LL
Protokoll n Wireless Kommunikation Protokoll • Sender: First Package byte 0 ROC TA 1 TA 2 TA 3 TA 4 DT MP 1 byte 8 MP 2 LL …… • ROC: 0 x 01, Request of Connection • TA 1…TA 4: TX Address • DT: Datatyp(Char, Int, Float, Double) • MP 1, MP 2: Maxmale Package Number int Max. Pack. Nr = (MP 1<<8)+MP 2; • LL: Last Package Length int Datalength = (Max. Pack. Nr-1)*29 + LL
Protokoll • Sender: • Empfanger: byte 3 byte 0 DAT PN 1 PN 2 Data byte 31 …… byte 0 Data CMD • DAT: 0 x 02, Data • PN 1, PN 2: Package Number int Pack. Nr = (PN 1<<8)+PN 2; • Data: Byte 3…Byte 31 …… • CMD: Command Byte 0 x 03: Accept of Connection 0 x 04: Accept of Data 0 x 05: Error Package Number
Protokoll B A Header ROC DAT 1 AOD DAT 2 A Pack. 1 DAT 1 Pack. 2 B DAT 1 Timeout Pack. 1 Pack. 2 B Timeout AOC Pack. 1 A Pack. 1 DAT 1 Pack. 1 AOD EPN
Literatur n n n n [1] [2] [3] [4] ds. PIC 30 F Family Reference Manual www. microchip. com ds. PIC 30 F 3013 Data Sheet www. microchip. com MPLAB C 30 C COMPILER USER'S GUIDE www. microchip. com NORDIC SEMICONDUCTOR, Single Chip 433/868/915 MHz Transceiver n. RF 905 www. nordicsemi. no [5] William Stallings, Data & Computer Communications Sixth Edition, Publishing House of Electronics Industry Beijing, 2001 [6] Karl-Dirk Kammeyer, Nachrichtenübertragung 3. Auflage, Teubner Verlag, 2004 [7] Gordon L. Stueber, Principles of Mobile Communication Second Edition, Kluwer Academic Publishers, 2001
279d13135560533ed53f948e342dffd8.ppt