Presentation is loading. Please wait.

Presentation is loading. Please wait.

HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Wireless MAC Practice (MAC I)

Similar presentations


Presentation on theme: "HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Wireless MAC Practice (MAC I)"— Presentation transcript:

1 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Wireless MAC Practice (MAC I)

2 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 2 Basic MAC Protocol

3 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 3 RF Chip and MAC Protocol in ZigbeX MAC Protocol in TinyOS –RF chip for Wireless Personal area networks (WPAN) by chipcon is CC2420. –TinyOS provides a CC2420Radio component for CC2420 control, which includes MAC implementation in CC2420Radio component. wireless MAC type CSMA/CA Carrier sensing RSSI based CCA Random Backoff MacBackoff and Random components retransmission DATA/ACK

4 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 4 MAC Protocol in TinyOS - 1 CCA(Clear Channel Assessment) –In order to use CSMA, it requires to assess channel status. –To sense carrier, TinyOS provides RSSI (Received Signal Strength Indicator) based CCA. –RSSI is strength of propagated signal by neighbors. CCA decides if the channel is busy based on the RSSI value.. –If CCA decides the channel busy, then the node need to wait till available.

5 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 5 Random Backoff –Backoff is used to avoid same time transmission by multiple nodes –Pick a random number within [0, N]. Wait for n*Slot-time. where N is # of attempts. MAC Protocol in TinyOS - 2

6 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 6 MAC Protocol in TinyOS - 3 ACK packet –If confliction, MAC protocol need to retransmit. –MAC protocol in TinyOS checks confliction using DATA/ACK packet. –If no ACK delivered to sender, retransmit the Data

7 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 7 Wireless RF Comm. Component CC2420RadioC component –GenericComm also is operated by CC2420RadioC component. –CC2420C located in \opt\tinyos ‐ 1.x\tos\lib\CC2420Radio –Basic MAC protocol used in TinyOS runs on CC2420RadioC.

8 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 8 BasicMAC Practice

9 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 9 BasicMAC practice BasicMAC example –BasicMAC example sends light value every second. A receiver blinks LED to tell successful delivery. BasicMAC example location –c:\Programfiles\UCB\cygwin\opt\tinyos ‐ 1.x\contrib\zigbex\BasicMAC\ –BasicMAC.nc & BasicMACM.nc

10 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 10 BasicMAC.nc –Components used in BasicMAC TimerC & LedsC DemoSensorC for light sensor GenericComm for RF communication includes BMAC; configuration BasicMAC { } implementation { components Main, BasicMACM, TimerC, LedsC, DemoSensorC as Sensor, GenericComm as Comm; Main.StdControl -> BasicMACM; … BasicMACM.CommControl -> Comm; BasicMACM.ResetCounterMsg -> Comm.ReceiveMsg[AM_BMACMSG]; BasicMACM.DataMsg -> Comm.SendMsg[AM_BMACMSG]; }

11 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 11 BasicMACM.nc BasicMACM.nc (1) includes BMAC; module BasicMACM { provides interface StdControl; uses { … } } implementation { … command result_t StdControl.init() { call Leds.init(); call Leds.yellowOff(); call Leds.redOff(); call Leds.greenOff(); call SensorControl.init(); call CommControl.init(); recvNumber = 0; return SUCCESS; } Inlcudes BMAC.h

12 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 12 BasicMACM.nc BasicMACM.nc (2) command result_t StdControl.start() { call SensorControl.start(); call CommControl.start(); call Timer.start(TIMER_REPEAT, 1000); return SUCCESS; } command result_t StdControl.stop() { call SensorControl.stop(); call Timer.stop(); call CommControl.stop(); return SUCCESS; } event result_t Timer.fired() { call Leds.greenToggle(); call Leds.yellowOn(); return call ADC.getData(); }

13 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 13 BasicMACM.nc BasicMACM.nc (3) async event result_t ADC.dataReady(uint16_t data) { atomic { pack = (struct BasicMAC_Msg *)msg.data; pack->data[0] = data; } if (call DataMsg.send(TOS_BCAST_ADDR, sizeof(struct BasicMAC_Msg), &msg)){ dbg(DBG_USR1, "DATA send SUCCESS!!!!!\n"); } return SUCCESS; } event result_t DataMsg.sendDone(TOS_MsgPtr sent, result_t success) { call Leds.yellowOff(); return SUCCESS; }

14 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 14 BasicMACM.nc BasicMACM.nc (4) event TOS_MsgPtr ResetCounterMsg.receive (TOS_MsgPtr m) { call Leds.redToggle(); recvNumber++; return m; }

15 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 15 BasicMAC Lab.

16 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 16 BasicMAC Lab 1 starts cygwin and move to c:\Programfiles\UCB\cygwin\opt\tinyos ‐ 1.x\contrib\zigbex\BasicMAC\ Compile - make zigbex cd /opt/tinyos ‐ 1.x/contrib/zigbex cd BasicMAC

17 HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 2016-06-04 17 BasicMAC results result –At every second Green LED & Yellow LED blinks –After Yellow LED blink (received) in one node, another node on/off Red LED (ACK received).


Download ppt "HANBACK ELECTRONICS CO., LTD. 저자권 보호됨 Wireless MAC Practice (MAC I)"

Similar presentations


Ads by Google