radio frequency (rf) data communications

54
Radio Frequency (RF) Data Radio Frequency (RF) Data Communications Communications By Danny Ton By Danny Ton Course: CSE 498 Course: CSE 498 Professor: Gaetano Borriello Professor: Gaetano Borriello

Upload: lytu

Post on 21-Dec-2016

232 views

Category:

Documents


6 download

TRANSCRIPT

Page 1: Radio Frequency (RF) Data Communications

Radio Frequency (RF) Data Radio Frequency (RF) Data CommunicationsCommunications

By Danny TonBy Danny TonCourse: CSE 498Course: CSE 498

Professor: Gaetano BorrielloProfessor: Gaetano Borriello

Page 2: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 2/44

OverviewOverview

Radio Frequency (RF) IntroductionRadio Frequency (RF) Introduction RF CharacteristicsRF Characteristics Regulations on RF ProductsRegulations on RF Products Virtual Wire® RF Monolithics TransceiversVirtual Wire® RF Monolithics Transceivers RFM FeaturesRFM Features RFM Data radio boardRFM Data radio board

– I/O interfaceI/O interface– TransmitterTransmitter– ReceiverReceiver– AGC/Antenna switchAGC/Antenna switch

Page 3: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 3/44

Overview (cont’d)Overview (cont’d)

Packet protocol boardPacket protocol board– I/O interfaceI/O interface– RS232 interfaceRS232 interface– Protocol microcontrollerProtocol microcontroller– CMOS/RS232 level converterCMOS/RS232 level converter

RFM link-layer packet protocolRFM link-layer packet protocol– Protocol featuresProtocol features– Principles of operationPrinciples of operation– Flow controlFlow control

Page 4: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 4/44

Radio Frequency (RF) Intro.Radio Frequency (RF) Intro.

Where RF fits in the frequency spectrumWhere RF fits in the frequency spectrum

Page 5: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 5/44

Radio Frequency (RF) Intro. (cont’d)Radio Frequency (RF) Intro. (cont’d)

Wireless communication technologyWireless communication technology– RF is an alternating current which, if supplied to an antenna, RF is an alternating current which, if supplied to an antenna,

will give rise to an electromagnetic field that propagates will give rise to an electromagnetic field that propagates through spacethrough space

Cheap and widely used Cheap and widely used – Over 40 millions systems manufactured each year utilizing Over 40 millions systems manufactured each year utilizing

low-power wireless (RF) technology for data links, telemetry, low-power wireless (RF) technology for data links, telemetry, control and securitycontrol and security

Wide range of applicationsWide range of applications– Cordless and cellular telephones, radio and television Cordless and cellular telephones, radio and television

broadcast stations, hand-held computer and PDA data links, broadcast stations, hand-held computer and PDA data links, wireless bar-code readers, wireless keyboards for PCs, wireless wireless bar-code readers, wireless keyboards for PCs, wireless security systems, consumer electronic remote control, etc.security systems, consumer electronic remote control, etc.

Page 6: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 6/44

RF CharacteristicsRF Characteristics

Low powerLow power– Typically transmit less than 1mW of powerTypically transmit less than 1mW of power

Good operating rangeGood operating range– Operate over distances of 3 to 30 metersOperate over distances of 3 to 30 meters

Supports data rate up to 1-2 Mbps Supports data rate up to 1-2 Mbps Penetrates wallsPenetrates walls Does not require a direct transmission path (as Does not require a direct transmission path (as

opposed to IR)opposed to IR)

Page 7: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 7/44

Regulations On RF ProductsRegulations On RF Products

Low-power wireless (RF) systems operate on Low-power wireless (RF) systems operate on shared radio channels and hence are subject to shared radio channels and hence are subject to regulation (by FCC in the US)regulation (by FCC in the US)

Regulation general philosophy: Products do not Regulation general philosophy: Products do not significantly interfere with licensed radio systemssignificantly interfere with licensed radio systems– Specify limitations on fundamental power, harmonic and Specify limitations on fundamental power, harmonic and

spurious emission levels, transmitter frequency stability, and spurious emission levels, transmitter frequency stability, and transmission bandwidthtransmission bandwidth

However, once certified to comply with However, once certified to comply with communication regulations, RF products do not communication regulations, RF products do not require a license (“air-time fee”) for operation require a license (“air-time fee”) for operation

Page 8: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 8/44

Virtual Wire® RF Monolithics TransceiversVirtual Wire® RF Monolithics Transceivers

Communication nodes capable of transmitting Communication nodes capable of transmitting and receiving dataand receiving data

Intended for use to implement low-power Intended for use to implement low-power wireless communications based on two-way wireless communications based on two-way half-duplex packet transmissions half-duplex packet transmissions

Page 9: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 9/44

RFM FeaturesRFM Features

Serial interface (RS232)Serial interface (RS232) Power supplyPower supply

– 4.5 Vdc from three 1.5 V AAA batteries4.5 Vdc from three 1.5 V AAA batteries Operating frequency: 916.50 MHzOperating frequency: 916.50 MHz Maximum data rate: 22.5 kbpsMaximum data rate: 22.5 kbps Operating range: up to 25 metersOperating range: up to 25 meters

– Obtained in an electrically quiet outdoor locationObtained in an electrically quiet outdoor location– Greatly influenced by building construction materials and Greatly influenced by building construction materials and

contents, other radio systems operating in the vicinity, and contents, other radio systems operating in the vicinity, and noise generated by nearby equipmentnoise generated by nearby equipment

Provide link-layer packet protocolProvide link-layer packet protocol

Page 10: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 10/44

RFM ModulesRFM Modules

Radio moduleRadio module– RFM data radio boardRFM data radio board– Transmit and receive RF signalsTransmit and receive RF signals

Protocol moduleProtocol module– 8-bit ATMEL AT89C2051 8-bit ATMEL AT89C2051

microcontroller on the protocol boardmicrocontroller on the protocol board– Implement link-layer packet protocolImplement link-layer packet protocol

RS232 moduleRS232 module– Maxim MAX218 Dual RS232 Maxim MAX218 Dual RS232

transceiver on the protocol boardtransceiver on the protocol board– Convert to and from 4.5V CMOS and Convert to and from 4.5V CMOS and

RS232 levelsRS232 levels– Interface to hostInterface to host

RF Signals

RF transmitter and Receiver

8-bit ATMEL AT89C2051 microcontroller

Host

MAX 218 ICCMOS/RS232 Level Converter

RS232module

Protocol module

Radiomodule

Protocol board

Data radio board

Page 11: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 11/44

Data Radio BoardData Radio Board

Page 12: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 12/44

Data Radio Board (cont’d)Data Radio Board (cont’d)

Maximum data rateMaximum data rate– 22.5 kbps22.5 kbps

Frequency optionsFrequency options– 916.5 MHz916.5 MHz

AntennaAntenna– Simple base-loaded monopole Simple base-loaded monopole

soldered to the pad provided for soldered to the pad provided for the 50 ohm RF inputthe 50 ohm RF input

– Alternatively, a 50-ohm coaxial Alternatively, a 50-ohm coaxial cable can be soldered to the RF cable can be soldered to the RF input pad and the adjacent input pad and the adjacent ground, if a remotely located ground, if a remotely located antenna is usedantenna is used

Page 13: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 13/44

Data Radio Board (cont’d)Data Radio Board (cont’d)

AGC adjustmentAGC adjustment– Data radio boards are adjusted at RFM for an AGC voltage between Data radio boards are adjusted at RFM for an AGC voltage between

1.75 and 1.80 V on the node between the potentiometer, R10, and 1.75 and 1.80 V on the node between the potentiometer, R10, and resistor R11 with no RF signal appliedresistor R11 with no RF signal applied

– This setting doesn’t affect the sensitivity level of the receiverThis setting doesn’t affect the sensitivity level of the receiver AGC adjustment purposeAGC adjustment purpose

– The desired signal must be larger than the undesired signal for the The desired signal must be larger than the undesired signal for the intelligible information to be obtained from the receiverintelligible information to be obtained from the receiver

– AGC circuit is not to level the desired signal level but, rather, to prevent AGC circuit is not to level the desired signal level but, rather, to prevent the saturation and eventual capture of the receiver’s demodulator by the saturation and eventual capture of the receiver’s demodulator by interfering in-band CW or FM signals (signals more than 20dB above the interfering in-band CW or FM signals (signals more than 20dB above the receiver sensitivity level)receiver sensitivity level)

– Turning the potentiometer counter-clockwise causes AGC voltage to Turning the potentiometer counter-clockwise causes AGC voltage to increase and, thus, engages the gain control at a lower signal level and increase and, thus, engages the gain control at a lower signal level and vice versavice versa

Page 14: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 14/44

Data Radio Board - I/O InterfaceData Radio Board - I/O Interface

Connector P1Connector P1– 8-pin connector interface to the protocol board8-pin connector interface to the protocol board

Pin 1Pin 1– Transmitter data input with input impedance of ~18 KΩTransmitter data input with input impedance of ~18 KΩ– Can be driven directly by a CMOS gateCan be driven directly by a CMOS gate– A high level voltage turns the transmitter oscillator on and A high level voltage turns the transmitter oscillator on and

a low level turns it offa low level turns it off Pin 2 and Pin 5Pin 2 and Pin 5

– VVCCCC for the transmitter and GND for the transmitter and GND Pin 3Pin 3

– PTT line that enable the transmit modePTT line that enable the transmit mode

Page 15: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 15/44

Data Radio Board - I/O Interface (cont’d)Data Radio Board - I/O Interface (cont’d)

– When it is high (2.5 V minimum at 2.0 mA maximum), this line When it is high (2.5 V minimum at 2.0 mA maximum), this line puts the transmit/receive RF switch in the transmit modeputs the transmit/receive RF switch in the transmit mode

Pin 4Pin 4– Power line to the receiver AGC circuitry: 2.7 - 3.3 VPower line to the receiver AGC circuitry: 2.7 - 3.3 V

Pin 6Pin 6– Reference voltage output (VRef) from the hybrid receiver used Reference voltage output (VRef) from the hybrid receiver used

in the “low battery” detection process on the protocol boardin the “low battery” detection process on the protocol board Pin 7Pin 7

– Power line to the receiver hybrid: 2.7 - 3.3 VPower line to the receiver hybrid: 2.7 - 3.3 V Pin 8Pin 8

– Data output from the comparator in the receiver hybridData output from the comparator in the receiver hybrid– CMOS compatible and capable of driving a single CMOS gateCMOS compatible and capable of driving a single CMOS gate

Page 16: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 16/44

Data Radio Board - TransmitterData Radio Board - Transmitter

An HX surface mount hybrid device (HX2000)An HX surface mount hybrid device (HX2000) Pin 1Pin 1

– Transmitter data input (connected to Pin 1 of connector P1)Transmitter data input (connected to Pin 1 of connector P1) Pin 2Pin 2

– Transmitter VTransmitter VCCCC power connection power connection– HX hybrids are specified to draw a maximum peak current of HX hybrids are specified to draw a maximum peak current of

10 - 11 mA with a V10 - 11 mA with a VCCCC of 3 V. Since the transmitter is only of 3 V. Since the transmitter is only turned on when the data line is high, the average transmitter turned on when the data line is high, the average transmitter current depends on the duty cycle of the incoming datacurrent depends on the duty cycle of the incoming data

Pin 3Pin 3– GroundGround

Page 17: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 17/44

Data Radio Board - Transmitter (cont’d)Data Radio Board - Transmitter (cont’d)

Pin 4Pin 4– RF ouputRF ouput

The RF output power of the HX is nominally The RF output power of the HX is nominally 0dBm with a 50Ω load0dBm with a 50Ω load– The transmitter power is applied to the antenna port through The transmitter power is applied to the antenna port through

the transmit/receive switch Q1the transmit/receive switch Q1 When the PTT line is pulled high, Q1 is turned on When the PTT line is pulled high, Q1 is turned on

to connect the transmitter to the antenna, Q3 is to connect the transmitter to the antenna, Q3 is turned on to short the receiver input to GND and turned on to short the receiver input to GND and Q2 is turned off to disconnect the receiver input Q2 is turned off to disconnect the receiver input from the antenna during transmissionfrom the antenna during transmission

Page 18: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 18/44

Data Radio Board - ReceiverData Radio Board - Receiver

An RX hybrid receiver (RX2056)An RX hybrid receiver (RX2056) Pin 1Pin 1

– VCC is applied to this pin from Pin 7 of connector P1VCC is applied to this pin from Pin 7 of connector P1– Also connected to a 10 uF bypass capacitor, C5, which Also connected to a 10 uF bypass capacitor, C5, which

keeps the RX internal comparator switching noise out of keeps the RX internal comparator switching noise out of the data base-band amplifier circuitry in the RXthe data base-band amplifier circuitry in the RX

Pin 2Pin 2– Base-band data outputBase-band data output– Signal at Pin 2 is the demodulated filtered data before it is Signal at Pin 2 is the demodulated filtered data before it is

applied to the comparator input, on Pin 3applied to the comparator input, on Pin 3– Output from this Pin is DC coupled to the internal detector Output from this Pin is DC coupled to the internal detector

outputoutput

Page 19: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 19/44

Data Radio Board - Receiver (Cont’d)Data Radio Board - Receiver (Cont’d)

Pin 3Pin 3– Comparator inputComparator input– Output from Pin 2 is connected to this pin by the coupling Output from Pin 2 is connected to this pin by the coupling

capacitor C6capacitor C6 Coupling capacitor C6Coupling capacitor C6

– Prevent the change in DC offset of the base-band amplifier Prevent the change in DC offset of the base-band amplifier from false triggering the comparatorfrom false triggering the comparator

– Prevent the DC output from the detector, produced by an in-Prevent the DC output from the detector, produced by an in-band CW or FM interfering signal, from triggering the band CW or FM interfering signal, from triggering the comparator while allowing changes in DC level, due to the comparator while allowing changes in DC level, due to the desired signal, to pass through to the comparator inputdesired signal, to pass through to the comparator input

– The value of the coupling capacitor is determined by the The value of the coupling capacitor is determined by the longest pulse width to be encountered in the data streamlongest pulse width to be encountered in the data stream

Page 20: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 20/44

Data Radio Board - Receiver (Cont’d)Data Radio Board - Receiver (Cont’d)

– The capacitor must be large enough to prevent the long data The capacitor must be large enough to prevent the long data pulses from sagging at the comparator inputpulses from sagging at the comparator input

Pin 4Pin 4– DC GNDDC GND

Pin 5Pin 5– The comparator threshold override pinThe comparator threshold override pin– If it is left open, the threshold voltage for comparator is If it is left open, the threshold voltage for comparator is

25mV. This voltage level is very desirable for the lower 25mV. This voltage level is very desirable for the lower frequency, full sensitivity receivers to reduce spurious noise frequency, full sensitivity receivers to reduce spurious noise at the comparator outputat the comparator output

– If it is grounded, the threshold voltage is zero volts. This is If it is grounded, the threshold voltage is zero volts. This is desirable for the 916.5 MHz receivers to obtain maximum desirable for the 916.5 MHz receivers to obtain maximum sensitivity possiblesensitivity possible

Page 21: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 21/44

Data Radio Board - Receiver (Cont’d)Data Radio Board - Receiver (Cont’d)

– To avoid spurious noise on the comparator output of the 916.5 To avoid spurious noise on the comparator output of the 916.5 MHz receivers, use a 10 MΩ resistor, R4, from Pin 3 to GND. MHz receivers, use a 10 MΩ resistor, R4, from Pin 3 to GND. This resistor effectively reduces to DC offset on the This resistor effectively reduces to DC offset on the comparator output, which is equivalent to using a very low comparator output, which is equivalent to using a very low threshold levelthreshold level

Pin 6Pin 6– The reference voltage output of the power supply included in The reference voltage output of the power supply included in

the custom IC used in the RXthe custom IC used in the RX– This pin must be bypassed by a 1 uF capacitor, C4, to avoid This pin must be bypassed by a 1 uF capacitor, C4, to avoid

comparator switching noise in the base-band amplifier.comparator switching noise in the base-band amplifier. Pin 7Pin 7

– The comparator output or data outputThe comparator output or data output– The comparator is capable of driving a single CMOS gate inputThe comparator is capable of driving a single CMOS gate input

Page 22: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 22/44

Data Radio Board - Receiver (Cont’d)Data Radio Board - Receiver (Cont’d)

Pins 8 and 9Pins 8 and 9– RF groundsRF grounds

Pin 10Pin 10– RF input port of the RX deviceRF input port of the RX device– This port is driven from a 50 Ω source This port is driven from a 50 Ω source

Page 23: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 23/44

Data Radio Board - AGC/Antenna SwitchData Radio Board - AGC/Antenna Switch

IssueIssue– The out-of-band interfering signal rejection of the amplifier-The out-of-band interfering signal rejection of the amplifier-

sequenced receiver architecture is excellent and allows the sequenced receiver architecture is excellent and allows the receiver to perform in the presence of large interfering receiver to perform in the presence of large interfering signals without range degradationsignals without range degradation

– However, this does not take care of in-band interference. The However, this does not take care of in-band interference. The majority of in-band interference encountered is CW and majority of in-band interference encountered is CW and primarily comes from unintentional radiators such as clock primarily comes from unintentional radiators such as clock harmonics from computers or local oscillators from harmonics from computers or local oscillators from superheterodyne receiverssuperheterodyne receivers

An AGC circuit primarily intended for CW or FM An AGC circuit primarily intended for CW or FM in-band interfering signals. These signals are of in-band interfering signals. These signals are of particular concern in an office environmentparticular concern in an office environment

Page 24: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 24/44

Data Radio Board - AGC/Antenna Switch Data Radio Board - AGC/Antenna Switch (cont’d)(cont’d)

The RX receiver has capacitive coupling between The RX receiver has capacitive coupling between the base-band amplifier output and the the base-band amplifier output and the comparator inputcomparator input

Hence, the DC level generated in the detector Hence, the DC level generated in the detector and base-band amplifier by either an FM or a CW and base-band amplifier by either an FM or a CW signal is blocked from the comparator input and signal is blocked from the comparator input and only desired signal passesonly desired signal passes

However, the DC level at which the detector and However, the DC level at which the detector and its associated base-band amplifier saturate is its associated base-band amplifier saturate is limited (approximately -80 dBm for 433.92 MHz, limited (approximately -80 dBm for 433.92 MHz, and -50 dBm for 916.5 MHz)and -50 dBm for 916.5 MHz)

Page 25: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 25/44

Data Radio Board - AGC/Antenna Switch Data Radio Board - AGC/Antenna Switch (cont’d)(cont’d)

The AGC circuit used on the data radio board The AGC circuit used on the data radio board is to prevent saturation of the detector and is to prevent saturation of the detector and base-band amplifier by keeping such in-band base-band amplifier by keeping such in-band interfering signals below the saturation level at interfering signals below the saturation level at the receiver inputthe receiver input

An RF attenuator (particularly transistors Q2 An RF attenuator (particularly transistors Q2 and Q3) is placed between the antenna and and Q3) is placed between the antenna and the receiver input, effectively extends the the receiver input, effectively extends the range over which the receiver can operate w/o range over which the receiver can operate w/o saturation by 40 dB (20 dB for each transistor)saturation by 40 dB (20 dB for each transistor)

Page 26: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 26/44

Data Radio Board - AGC/Antenna Switch Data Radio Board - AGC/Antenna Switch (cont’d)(cont’d)

The RF attenuators Q1, Q2, and Q3 also serve The RF attenuators Q1, Q2, and Q3 also serve as the transmit/receive RF switch for the radio as the transmit/receive RF switch for the radio boardboard– In transmit mode, the PTT line is pulled high, overriding the In transmit mode, the PTT line is pulled high, overriding the

AGC circuit by directly biasing the bases of Q1 and Q3 on AGC circuit by directly biasing the bases of Q1 and Q3 on and turning the base of Q2 off through R15 and U1B. This and turning the base of Q2 off through R15 and U1B. This connects the transmitter to the antenna port and connects the transmitter to the antenna port and disconnects the receiver from the antenna portdisconnects the receiver from the antenna port

– In receive mode, PTT is low, allowing the receiver to be In receive mode, PTT is low, allowing the receiver to be connected to the antenna port with its input level connected to the antenna port with its input level controlled by the AGC circuit onlycontrolled by the AGC circuit only

Page 27: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 27/44

Packet Protocol BoardPacket Protocol Board

Page 28: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 28/44

Packet Protocol Board (cont’d)Packet Protocol Board (cont’d)

Why not connect the data radio board directly to a Why not connect the data radio board directly to a computer serial port using an RS232 to CMOS level computer serial port using an RS232 to CMOS level converter?converter?– Error detection limited to byte parity checking: many errors go Error detection limited to byte parity checking: many errors go

undetectedundetected– Greatly reduce the data radio’s range due to very poor DC Greatly reduce the data radio’s range due to very poor DC

balance in the databalance in the data The protocol microcontroller provides data-link The protocol microcontroller provides data-link

protocolprotocol– error dectectionerror dectection– automatic message retransmissionautomatic message retransmission– message routingmessage routing– link alarms and DC-balanced packet codinglink alarms and DC-balanced packet coding

Page 29: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 29/44

Packet Protocol Board (cont’d)Packet Protocol Board (cont’d)

Node address programmingNode address programming– Maximum of 15 nodes addresses, set by placing jumpers Maximum of 15 nodes addresses, set by placing jumpers

on the double row of pins located between the two IC’son the double row of pins located between the two IC’s

Page 30: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 30/44

Packet Protocol Board (cont’d)Packet Protocol Board (cont’d)

Power supply optionsPower supply options– 4.5 Vdc nominal from three 1.5 V AAA batteries4.5 Vdc nominal from three 1.5 V AAA batteries

RS232 interfaceRS232 interface– Level conversion from 4.5V CMOS to RS232 levels is provided by Level conversion from 4.5V CMOS to RS232 levels is provided by

the MAX 218 IC.the MAX 218 IC.– It is possible to remove this IC and jumper socket Pin 7 to 14 and It is possible to remove this IC and jumper socket Pin 7 to 14 and

Pin 9 to 12 for direct CMOS operationPin 9 to 12 for direct CMOS operation LED functions: Three LED indicators are provided on LED functions: Three LED indicators are provided on

the protocol boardthe protocol board– RXI indicates RF signals are being received (Diode D5)RXI indicates RF signals are being received (Diode D5)– RF RCV indicates a valid RF packet has been received (DiodeD4)RF RCV indicates a valid RF packet has been received (DiodeD4)– PC RCV indicates a message has been received from PC (Diode PC RCV indicates a message has been received from PC (Diode

D3)D3)

Page 31: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 31/44

Packet Protocol Board - I/O InterfacePacket Protocol Board - I/O Interface

Connector J1Connector J1– The I/O interface between the protocol and data radio boardsThe I/O interface between the protocol and data radio boards– 8 pins8 pins

Pin 1Pin 1– Carry the transmit data stream from U2-Pin 7 to the RTX input Carry the transmit data stream from U2-Pin 7 to the RTX input

on the data radio boardon the data radio board Pin 2Pin 2

– Provide power to the transmitter hybrid on the radio boardProvide power to the transmitter hybrid on the radio board Pin 3Pin 3

– Provide the transmit enable signal (PTT) from PNP transitor Q2Provide the transmit enable signal (PTT) from PNP transitor Q2– The data radio board requires 2 mA at 2.5 V on the PTT input to The data radio board requires 2 mA at 2.5 V on the PTT input to

enable the transmit modeenable the transmit mode

Page 32: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 32/44

Packet Protocol Board - I/O Interface Packet Protocol Board - I/O Interface (cont’d)(cont’d)

Pin 4Pin 4– Provide power to the receiver AGC circuitryProvide power to the receiver AGC circuitry

Pin 5 - GNDPin 5 - GND Pin 6Pin 6

– The reference voltage input (VREF) from the hybrid receiver to The reference voltage input (VREF) from the hybrid receiver to the protocol board, used in the low battery detection processthe protocol board, used in the low battery detection process

Pin 7Pin 7– Provide power to the receiver hybridProvide power to the receiver hybrid

Pin 8Pin 8– Receiver output signal (RRX) from the data radio boardReceiver output signal (RRX) from the data radio board– FET Q1 provides the required high input impedance buffer FET Q1 provides the required high input impedance buffer

between this signal and the input to U2between this signal and the input to U2

Page 33: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 33/44

Packet Protocol Board - RS232 InterfacePacket Protocol Board - RS232 Interface

Connector J2Connector J2– 9-pin female connector configured to appear as a DCE (modem)9-pin female connector configured to appear as a DCE (modem)– The protocol board implements software flow control, so only The protocol board implements software flow control, so only

Pins 2 and 3 carry active signalPins 2 and 3 carry active signal Pin 2 (RD or PTX)Pin 2 (RD or PTX)

– Send data to the host computerSend data to the host computer Pin 3 (TD or PRX)Pin 3 (TD or PRX)

– Receive data from the host computerReceive data from the host computer Pins 4 and 6 (DTR & DSR) are connected; Pins 1, 7, Pins 4 and 6 (DTR & DSR) are connected; Pins 1, 7,

and 8 are also connectedand 8 are also connected Pin 5 - GNDPin 5 - GND

Page 34: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 34/44

Packet Protocol BoardPacket Protocol BoardProtocol MicrocontrollerProtocol Microcontroller

Implements the link-layer protocolImplements the link-layer protocol An 8-bit ATMEL AT89C2051 Microcontroller (U2)An 8-bit ATMEL AT89C2051 Microcontroller (U2)

– Operates from an 22.118 MHz quartz crystalOperates from an 22.118 MHz quartz crystal– 2 Kbytes of flash PEROM memory and 128 bytes of RAM2 Kbytes of flash PEROM memory and 128 bytes of RAM– Two 16-bit timers Two 16-bit timers – A hardware serial portA hardware serial port

The timers and hardware serial port makes it The timers and hardware serial port makes it especially suitable as a link-layer packet controllerespecially suitable as a link-layer packet controller

The timers, serial port and input interrupts remain The timers, serial port and input interrupts remain active while the processor is in the power-saving idle active while the processor is in the power-saving idle mode, allowing the link-layer protocol to be mode, allowing the link-layer protocol to be implemented on a low average current budgetimplemented on a low average current budget

Page 35: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 35/44

Packet Protocol BoardPacket Protocol BoardProtocol Microcontroller (cont’d)Protocol Microcontroller (cont’d)

Inputs to the microcontrollerInputs to the microcontroller– Node programming pins ID0 - ID3 (Pins 14, 15, 16, and 17)Node programming pins ID0 - ID3 (Pins 14, 15, 16, and 17)– The buffered receive data (RRX) on Pin 6The buffered receive data (RRX) on Pin 6– The CMOS-level input from the host computer (Pin 2)The CMOS-level input from the host computer (Pin 2)– The reference voltage (VREF) input on Pin 13The reference voltage (VREF) input on Pin 13

Outputs from the microcontrollerOutputs from the microcontroller– The transmit data on Pin 7The transmit data on Pin 7– The data output to the host computer on Pin 3The data output to the host computer on Pin 3– The transmit enable signal on Pin 19The transmit enable signal on Pin 19– The RS232-transceiver control on Pin 18The RS232-transceiver control on Pin 18– The LED outputs on Pins 8 (RXI), 9 (RF RCV) and 11 (PC RCV)The LED outputs on Pins 8 (RXI), 9 (RF RCV) and 11 (PC RCV)

Diode D2 and capacitor C7 form the power-up reset Diode D2 and capacitor C7 form the power-up reset circuit for the microcontrollercircuit for the microcontroller

Page 36: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 36/44

Packet Protocol BoardPacket Protocol BoardCMOS/RS232 Level ConverterCMOS/RS232 Level Converter

Conversion to and from RS232 and 4.5V CMOS Conversion to and from RS232 and 4.5V CMOS logic levels is done by a Maxim MAX218 Dual logic levels is done by a Maxim MAX218 Dual RS232 Transceiver (U1)RS232 Transceiver (U1)

The operation of MAX218 is controlled by the The operation of MAX218 is controlled by the microcontroller (U2) to minimize average current microcontroller (U2) to minimize average current consumptionconsumption

L1, D1, and C5 operate in conjunction with the L1, D1, and C5 operate in conjunction with the IC’s switch-mode power supply to generate +/-6.5 IC’s switch-mode power supply to generate +/-6.5 V for the transmitter and receiver conversionsV for the transmitter and receiver conversions

Pin 3 on the MAX 218Pin 3 on the MAX 218– Controls the switched-mode supply via U2 Pin 18Controls the switched-mode supply via U2 Pin 18

Page 37: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 37/44

Packet Protocol BoardPacket Protocol BoardCMOS/RS232 Level Converter (cont’d)CMOS/RS232 Level Converter (cont’d)

The RS232 serial input signal from J2-Pin 3 is The RS232 serial input signal from J2-Pin 3 is input on U1-Pin 12 and is converted to a 3V CMOS input on U1-Pin 12 and is converted to a 3V CMOS level (note inversion) and output on U1-Pin 9level (note inversion) and output on U1-Pin 9

The CMOS serial output signal from U2-Pin 2 is The CMOS serial output signal from U2-Pin 2 is input on U1-Pin 9 and converted to an RS232 input on U1-Pin 9 and converted to an RS232 output (note inversion) on U1-Pin 12. This signal output (note inversion) on U1-Pin 12. This signal is found on J2-Pin 3is found on J2-Pin 3

Bypass RS232 conversion for direct CMOS Bypass RS232 conversion for direct CMOS operation by removing U1 from its socket and operation by removing U1 from its socket and placing one jumper in socket Pins 7 and 14 and a placing one jumper in socket Pins 7 and 14 and a second jumper in socket Pins 9 and 12second jumper in socket Pins 9 and 12

Page 38: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 38/44

RFM Link-Layer Packet ProtocolRFM Link-Layer Packet Protocol

Firmware running on the protocol boardFirmware running on the protocol board Provide automatic, verified, error-free Provide automatic, verified, error-free

transmission of messages between Virtual transmission of messages between Virtual Wire® radio nodesWire® radio nodes– Radio packet formatRadio packet format

Provide link-layer interface between a Virtual Provide link-layer interface between a Virtual Wire® transceiver and its host processor via Wire® transceiver and its host processor via serial connectionserial connection– RS232 packet formatRS232 packet format

Page 39: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 39/44

RFM Link-Layer Packet Protocol (cont’d)RFM Link-Layer Packet Protocol (cont’d)

Radio packet formatRadio packet format– To/From:To/From:

• To (higher 4 bits): receiver node addressTo (higher 4 bits): receiver node address• From (lower 4 bits): sender node addressFrom (lower 4 bits): sender node address• 0x00: broadcast packet0x00: broadcast packet• 15 different node addresses available15 different node addresses available

– Packet number byte: 1-7Packet number byte: 1-7– Data size byte:Data size byte:

• Number of actual data bytesNumber of actual data bytes– Message dataMessage data

• ASCII or binary, up to 32 bytesASCII or binary, up to 32 bytes– 16-bit FCS (Frame Check Sequence)16-bit FCS (Frame Check Sequence)

• 16-bit ISO 3309 error detection calculation to test 16-bit ISO 3309 error detection calculation to test message integritymessage integrity

• The calculation is based on all bits in the message The calculation is based on all bits in the message following the start symbolfollowing the start symbol

To/From

Packet number

Data Size

Message Data

Start Symbol(0x55)

16-bit FCS

Radio packet

Page 40: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 40/44

RFM Link-Layer Packet Protocol (cont’d)RFM Link-Layer Packet Protocol (cont’d)

RS232-side packet formatRS232-side packet format– Radio packet format without the Radio packet format without the

Start symbol and the 16-bit FCSStart symbol and the 16-bit FCS Example of a RS232-side Example of a RS232-side

packet from node 3 to node 2, packet from node 3 to node 2, with one is the packet with one is the packet number, containing 3 bytes of number, containing 3 bytes of datadata

23 01 03 02 1C 0323 01 03 02 1C 03

To/From

Packet number

Data Size

Message Data

RS232-side packet

Page 41: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 41/44

RFM Link-Layer Packet Protocol (cont’d)RFM Link-Layer Packet Protocol (cont’d)

Automatic packet retransmission until Automatic packet retransmission until acknowledgment is received; 8 retries acknowledgment is received; 8 retries with semi-random back-off delays (0, with semi-random back-off delays (0, 120, 240, or 360 ms)120, 240, or 360 ms)

ACK and NAK alarm messages to hostACK and NAK alarm messages to host Operation on both the RS232 side Operation on both the RS232 side

and the radio side is half-duplexand the radio side is half-duplex– The protocol software services one input The protocol software services one input

line at a time (radio or RS232 receive line)line at a time (radio or RS232 receive line)– Since the protocol does not support Since the protocol does not support

hardware flow control, host software will hardware flow control, host software will have to do some timekeeping to interface have to do some timekeeping to interface to the protocol software (avoid sending to the protocol software (avoid sending data if RFM is busy)data if RFM is busy)

To/From

Packet number

0xDD

NAK

To/From

Packet number

0xEn (n=1to 8)

ACK

Page 42: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 42/44

Theory of OperationTheory of Operation

Operation of RS232 serial connectionsOperation of RS232 serial connections– 19.2 kbps19.2 kbps– Eight data bits (byte), one stop bit, and no parity bitEight data bits (byte), one stop bit, and no parity bit

Radio operationRadio operation– Transmission rate of 22.5 kbps, using 12-bit dc-balanced Transmission rate of 22.5 kbps, using 12-bit dc-balanced

symbol representing the data bytesymbol representing the data byte– Radio receiver is slightly “squelched” when not receiving Radio receiver is slightly “squelched” when not receiving

data, and will output occasional random positive noise spikesdata, and will output occasional random positive noise spikes Messages are sent and received from the RS232 Messages are sent and received from the RS232

interface in standard asynchronous format via interface in standard asynchronous format via PTX and PRXPTX and PRX

Page 43: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 43/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

I/O lines on the protocol microcontrollerI/O lines on the protocol microcontroller– RRX - radio receive line (J1-8)RRX - radio receive line (J1-8)– RTX - radio transmit line (J1-1)RTX - radio transmit line (J1-1)– PTT - radio transmit/receive control line, high on transmit PTT - radio transmit/receive control line, high on transmit

(J1-3)(J1-3)– PRX - RS232 receive line (J2-3)PRX - RS232 receive line (J2-3)– PTX - RS232 transmit line (J2-2)PTX - RS232 transmit line (J2-2)– RXI, RF RCV, PC RCV - three LED control linesRXI, RF RCV, PC RCV - three LED control lines

Page 44: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 44/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

The protocol software continually tests the RRX The protocol software continually tests the RRX and the PRX lines searching for a start bitand the PRX lines searching for a start bit

When the start bit is detected on one of the input When the start bit is detected on one of the input lines (radio or RS232), the software will attempt lines (radio or RS232), the software will attempt to receive a message on that input lineto receive a message on that input line

If error is detected, the message will be discarded If error is detected, the message will be discarded and the software will resume testing the input and the software will resume testing the input lineslines

If a valid message is received on the PRX input If a valid message is received on the PRX input line, the software will format a radio packet from line, the software will format a radio packet from the message and queue the packet for xmissionthe message and queue the packet for xmission

Page 45: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 45/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

Each byte xmitted by the radio is Each byte xmitted by the radio is converted into a 12 bit, dc-converted into a 12 bit, dc-balanced symbol for best noise balanced symbol for best noise immunityimmunity

The queued packet is xmitted The queued packet is xmitted (RTX line with PTT high), and the (RTX line with PTT high), and the software then looks for a “packet software then looks for a “packet received” ACK (on the RRX line)received” ACK (on the RRX line)

Radio ACK: | 0x55 | RS232 ACK | FCS |Radio ACK: | 0x55 | RS232 ACK | FCS | On acknowledgement of the On acknowledgement of the

queued packet, an ACK (less Start queued packet, an ACK (less Start symbol and FCS) is sent to host on symbol and FCS) is sent to host on PTX line, and the queued packet is PTX line, and the queued packet is discarded. The software then discarded. The software then resumes testing the input linesresumes testing the input lines

Host SenderNode

ReceiverNode

# 1# 1

ACK on # 1

ACK on # 1

# 2

ACK on # 2

ACK on # 2

# 2

RS232-sidePackets

RadioPackets

Normal operation

Page 46: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 46/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

If an acknowledgement If an acknowledgement packet is not received in packet is not received in 120ms, the packet is then 120ms, the packet is then resent after a randomly resent after a randomly selected delay of 0, 120, 240 selected delay of 0, 120, 240 or 360ms.or 360ms.

If the packed is not If the packed is not acknowledged after a total of acknowledged after a total of eight tries, the software will eight tries, the software will send a NAK message to host send a NAK message to host on the PTX line, discard the on the PTX line, discard the queued packet, and resume queued packet, and resume testing the input linestesting the input lines

Host SenderNode

ReceiverNode

# 1

# 1

RS232-sidePackets

RadioPackets

Try 1 on pkt #1

Try 2 on pkt #1

Try 8 on pkt #1

NAK on # 1

120ms

Random delaysbetween tries

(Dropped)

Link-failure operation

Page 47: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 47/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

When a start symbol is detected on the RRX When a start symbol is detected on the RRX line, the software will attempt to receive and line, the software will attempt to receive and verify a message by checking for a correct verify a message by checking for a correct TO/FROM address, a valid packet sequence TO/FROM address, a valid packet sequence number, and a valid number of data bytes (or number, and a valid number of data bytes (or “ACK” character), and a correct FCS “ACK” character), and a correct FCS calculationcalculation

If the message is not valid, it is discarded and If the message is not valid, it is discarded and testing the input lines is resumedtesting the input lines is resumed

Page 48: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 48/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

If the packet is verified and the “TO” nibble If the packet is verified and the “TO” nibble matches, the TO/FROM address, packet matches, the TO/FROM address, packet sequence number, number of data bytes and sequence number, number of data bytes and the data bytes of the message (i.e a RS232-the data bytes of the message (i.e a RS232-side packet) are sent out on the PTX line, and side packet) are sent out on the PTX line, and a radio ACK is transmitted back on the RTX a radio ACK is transmitted back on the RTX line.line.

If an acknowledged packet is received a If an acknowledged packet is received a second time (based on the current value of the second time (based on the current value of the message sequence counter), it is reacked on message sequence counter), it is reacked on RTX but not retransmitted on PTXRTX but not retransmitted on PTX

Page 49: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 49/44

Theory of Operation (cont’d)Theory of Operation (cont’d)

The software will accept message packets and The software will accept message packets and acknowledgement packets in any sesquenceacknowledgement packets in any sesquence

BroadcastingBroadcasting– The TO/FROM address of 0x00 is treated as a “broadcast” The TO/FROM address of 0x00 is treated as a “broadcast”

packet. In this case, a received packet is sent out on the packet. In this case, a received packet is sent out on the PTX line if the number of data bytes are in a valid range PTX line if the number of data bytes are in a valid range and the FCS calculation matches.and the FCS calculation matches.

– A broadcast packet is not acknowledged by the receiving A broadcast packet is not acknowledged by the receiving node(s)node(s)

– In the broadcast mode, the packet is transmitted eight In the broadcast mode, the packet is transmitted eight times to enhance probability or reception.times to enhance probability or reception.

Page 50: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 50/44

Flow ControlFlow Control

The protocol software does not support flow The protocol software does not support flow control control

If a start bit is detected on either RRX or PRX, the If a start bit is detected on either RRX or PRX, the software receives and acts on the information on software receives and acts on the information on that input line and doesn’t service the other input that input line and doesn’t service the other input line until it has received and acted on the data of line until it has received and acted on the data of the first input linethe first input line

Host application will have to do some Host application will have to do some timekeeping to make sure that the RFM is not timekeeping to make sure that the RFM is not busy. This is done by sending just the To/From busy. This is done by sending just the To/From address byte to the RFMaddress byte to the RFM

Page 51: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 51/44

Flow Control (cont’d)Flow Control (cont’d)

If this byte is echoed back within 50ms, host If this byte is echoed back within 50ms, host application has control of the PRX interrupt process application has control of the PRX interrupt process and can send the rest of the packet in the following and can send the rest of the packet in the following 200ms200ms

Else, it can assume that the RFM is busy on an RRX Else, it can assume that the RFM is busy on an RRX interrupt either receiving a packet or tripped by interrupt either receiving a packet or tripped by receiver output noise. The host program should hold receiver output noise. The host program should hold off about 100ms and retry.off about 100ms and retry.

An inbound packet can occur at any time, so any An inbound packet can occur at any time, so any character with the high nibble equal to the local node character with the high nibble equal to the local node address or any 0x00 byte should be processed to test address or any 0x00 byte should be processed to test for a valid messagefor a valid message

Page 52: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 52/44

Sample CodesSample Codes

RFSend(Byte ToFrom, Char* Data)RFSend(Byte ToFrom, Char* Data){{FIRST:FIRST:

SerSend(ToFrom, 1);SerSend(ToFrom, 1);

SECOND:SECOND:begin = TimGetTicks();begin = TimGetTicks();do {do {end = TimGetTicks();end = TimGetTicks();SerReceiveCheck(&numBytes);SerReceiveCheck(&numBytes);} while(numBytes < 0 && (end-begin/100) < .05);} while(numBytes < 0 && (end-begin/100) < .05);

THIRD:THIRD:if(numBytes > 0) {if(numBytes > 0) { SerReceive(rcvQueue, numBytes);SerReceive(rcvQueue, numBytes); if(rcvQueue[0] == ToFrom) {if(rcvQueue[0] == ToFrom) { SerSend(pktNum, 1);SerSend(pktNum, 1); SerSend(StrLen(data), 1);SerSend(StrLen(data), 1); SerSend(data, StrLen(data));SerSend(data, StrLen(data));

FIRST:FIRST:Send ToFrom byte to RFMSend ToFrom byte to RFM

SECOND:SECOND:Check to see if anything is Check to see if anything is echoed back in 50msechoed back in 50ms

THIRD:THIRD:Check to see if this byte is the Check to see if this byte is the ToFrom byteToFrom byteIf it is, then RFM is ready for If it is, then RFM is ready for the rest of the packet: packet the rest of the packet: packet number, data size, and actual number, data size, and actual data; else, can assume that data; else, can assume that RFM is busy.RFM is busy.

Note: assume data size is less Note: assume data size is less than 32 bytes, which is the than 32 bytes, which is the maximum number of bytes maximum number of bytes that a packet can takethat a packet can take

Page 53: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 53/44

Sample Codes (cont’d)Sample Codes (cont’d)

FOURTH:FOURTH: SerReceive(rcvQueue, 3);SerReceive(rcvQueue, 3); switch(rcvQueue[2]) {switch(rcvQueue[2]) {case 0xE1:case 0xE1:case 0xE2:case 0xE2:case 0xE3:case 0xE3:case 0xE4:case 0xE4:case 0xE5:case 0xE5:case 0xE6:case 0xE6:case 0xE7:case 0xE7:case 0xE8: if(++pktNum >= 8) pktNum = 1;case 0xE8: if(++pktNum >= 8) pktNum = 1;return true;return true;case 0xDD: return false;case 0xDD: return false; }} }}}}return false;return false;

}}

FOURTH:FOURTH:Receive the echo-back packet Receive the echo-back packet (3 bytes in size)(3 bytes in size)If the last byte is 0xEn where n If the last byte is 0xEn where n = 1 - 8 (the number of retries), = 1 - 8 (the number of retries), then the packet is the ACK, then the packet is the ACK, and data is successfully sent and data is successfully sent and received; Else, if the last and received; Else, if the last byte is 0xDD, it is the NAK, byte is 0xDD, it is the NAK, signaling a link failuresignaling a link failure

Page 54: Radio Frequency (RF) Data Communications

CSE 477 Winter 1999 Introduction 54/44

Sample Codes (cont’d)Sample Codes (cont’d)

RFReceive(Byte localAddr, Byte* From, Byte* PktNum, Char* RFReceive(Byte localAddr, Byte* From, Byte* PktNum, Char* retData)retData)

{{FIRST:FIRST:

SerReceiveCheck(&numBytes);SerReceiveCheck(&numBytes);if (numBytes > 3) {if (numBytes > 3) { SerReceive(rcvQueue, 1);SerReceive(rcvQueue, 1);

SECOND:SECOND: if ((rcvQueue[0] >> 4) == localAddr) {if ((rcvQueue[0] >> 4) == localAddr) {SerReceive(rcvQueue+1, 2);SerReceive(rcvQueue+1, 2);*From = rcvQueue[0] & 0x0F; // Get FROM nibble*From = rcvQueue[0] & 0x0F; // Get FROM nibble*PktNum = rcvQueue[1];*PktNum = rcvQueue[1];SerReceive(rcvQueue+3, rcvQueue[2]);SerReceive(rcvQueue+3, rcvQueue[2]);StrCopy(retData, rcvQueue+3);StrCopy(retData, rcvQueue+3);return true;return true; }}}}return false;return false;

}}

FIRST:FIRST:Check the serial receive Check the serial receive queue to see whether at queue to see whether at least 3 bytes have been least 3 bytes have been received (To/From, packet received (To/From, packet number, packet size)number, packet size)

SECOND:SECOND:Get the first byte to see if it Get the first byte to see if it is equal to the local node is equal to the local node addressaddressIf it is, get the next 2 bytes: If it is, get the next 2 bytes: packet number and packet packet number and packet size, and then get the rest of size, and then get the rest of the packet based on the the packet based on the packet size received;packet size received;Else, do nothingElse, do nothing