05.01.2013 Views

Protocol Design and Implementation of Vehicular Ad-hoc Networks

Protocol Design and Implementation of Vehicular Ad-hoc Networks

Protocol Design and Implementation of Vehicular Ad-hoc Networks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

module, a 2 byte value is also received though it<br />

may not be used in some cases.<br />

When the system is first powered up, a<br />

function is called which initializes the RMF12<br />

module by giving it a number <strong>of</strong> comm<strong>and</strong>s to<br />

bring it to the desired settings <strong>and</strong> enabling all<br />

required features. To transmit a byte <strong>of</strong> data, the<br />

FM module is given the comm<strong>and</strong> “B8XXH”<br />

where XX is the byte to be transmitted. Before<br />

transmitting our data payload, we must first<br />

transmit the preamble “AAAAAAH” followed by<br />

the synchronization bit sequence “2DD4H” [8].<br />

When the module receives a byte <strong>of</strong> data, it stores<br />

it in its receiver FIFO register. To read this<br />

register, the module is given the comm<strong>and</strong><br />

B000H. The data will be in the lower byte <strong>of</strong> the<br />

two byte data received. The received data must be<br />

read immediately after receiving; otherwise the<br />

register will be overwritten if more data is<br />

received.<br />

B. <strong>Protocol</strong> Details<br />

The RFM12 module is only capable <strong>of</strong><br />

performing one function at a time; that is, it is<br />

unable to transmit <strong>and</strong> receive at the same time.<br />

Thus, it is only put into transmitting mode when<br />

some data is to be sent, <strong>and</strong> then shifted back to<br />

receiving or listening mode. Another point <strong>of</strong><br />

importance is the switching <strong>of</strong> the module<br />

between channels. With channel 1 at 433MHz <strong>and</strong><br />

channel 2 at 439.75MHz, The FM transceiver is<br />

tuned to listen at the channel where the next frame<br />

is expected to arrive.<br />

The Broadcasting Unit <strong>of</strong> the Roadside<br />

Module is programmed to transmit a DR frame<br />

followed by 49 SB frames with delays <strong>of</strong> 100ms<br />

between them <strong>and</strong> the cycle is repeated<br />

continuously. This results in a DR frame being<br />

transmitted once every 5 seconds, <strong>and</strong> at this<br />

moment, the BU triggers an interrupt on the<br />

Responding Unit. The RU then opens up the<br />

UART connection between it <strong>and</strong> the<br />

Broadcasting Unit <strong>and</strong> the BU obtains the vehicle<br />

count in the region from the RU over the<br />

connection. The BU then uses this updated value<br />

in the DR <strong>and</strong> SB frames it is broadcasting. The<br />

BU does not expect to receive anything so it<br />

remains in the transmitting mode. Also, all the<br />

frames it transmits are in ch1.<br />

It is the job <strong>of</strong> the Responding Unit <strong>of</strong> the<br />

Roadside Module to wait for vehicles to contact it,<br />

<strong>and</strong> when they do, to acknowledge their<br />

transmission. The RU keeps a one byte global<br />

722<br />

variable rx_frame which is initially initialized to<br />

zero. When the FM transceiver receives data, the<br />

nIRQ pin <strong>of</strong> the module goes low <strong>and</strong> this triggers<br />

an interrupt on the microcontroller. The Interrupt<br />

service routine calls a function which stores the<br />

received frame in the rx_frame variable. The RU<br />

only expects to receive frames in channel2.<br />

Therefore, it initially tunes to ch2 in the receiving<br />

mode <strong>and</strong> waits, continuously polling the valid bit<br />

<strong>of</strong> rx_frame. The valid bit going high indicates a<br />

frame being received, <strong>and</strong> the RU saves the<br />

required data from the frame before clearing it to<br />

make it ready for the next received frame. If the<br />

received frame is a VR frame, the RU will enter<br />

the transmission mode briefly to transmit the ACK<br />

frame (in ch2) <strong>and</strong> enter the vID <strong>of</strong> the vehicle in<br />

the array v_list. This array contains entries <strong>of</strong><br />

vehicles registered to the station. The RU will also<br />

trigger an interrupt on the BU signalling it to<br />

listen to the UART connection opened by the RU,<br />

over which the RU will send the updated vehicle<br />

count to the BU. It may be possible that the<br />

vehicle may not receive an ACK for some reason,<br />

in which case it will transmit the VR frame. The<br />

RU must detect <strong>and</strong> ignore duplicate VR frames.<br />

The RU treats E frames in a similar manner. It<br />

maintains an emergency list where it keeps<br />

records <strong>of</strong> vehicles facing an emergency. Each<br />

entry is valid only for 30s after which it is<br />

removed.<br />

The <strong>Vehicular</strong> Module is undoubtedly the<br />

most complex <strong>of</strong> the three. It must listen at both<br />

the channels for specific frames as well as<br />

properly h<strong>and</strong>le <strong>and</strong> forward Emergency frames.<br />

The VM initially listens at ch1 for the SB, DR or<br />

E frame <strong>and</strong> remains in this state for the majority<br />

<strong>of</strong> the time. To transmit the VR frame, the VM<br />

switches to ch2. It then starts a timer <strong>and</strong> waits for<br />

the ACK frame. If it is received before the timer<br />

overflows, the VM saves the sID <strong>of</strong> the station. As<br />

soon as an ACK is received, or the timer<br />

overflows, the VM will switch back to ch1 <strong>and</strong><br />

continue listening. If the vehicle receives an E<br />

frame, <strong>and</strong> the frame is found not to be a<br />

duplicate, the VM will enter the vID <strong>of</strong> the<br />

received frame in its emergency list. It will then<br />

check the TTL value <strong>of</strong> the frame, <strong>and</strong> if it is zero,<br />

it will take no further action. If the TTL value is<br />

non-zero, the VM will decrement it <strong>and</strong> transmit<br />

the modified E frame in ch1 where it will be<br />

received by other nearby vehicles <strong>and</strong><br />

retransmitted. If a vehicle has an accident it will

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!