1 / 17

Wireless MAC Practice (MAC I)

Wireless MAC Practice (MAC I). Basic MAC Protocol. RF Chip and MAC Protocol in ZigbeX. MAC Protocol in TinyOS RF chip for Wireless Personal area networks (WPAN) by chipcon is CC2420.

amberlyj
Télécharger la présentation

Wireless MAC Practice (MAC I)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wireless MAC Practice (MAC I)

  2. Basic MAC Protocol

  3. RF Chip and MAC Protocol in ZigbeX • MAC Protocol in TinyOS • RF chip for Wireless Personal area networks (WPAN) by chipcon isCC2420. • TinyOS provides a CC2420Radio component for CC2420 control, which includes MAC implementation in CC2420Radio component.

  4. MAC Protocolin 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. • RSSIisstrength 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. MAC Protocolin TinyOS - 2 • RandomBackoff • 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.

  6. MAC Protocolin TinyOS - 3 • ACK packet • If confliction, MAC protocol need to retransmit. • MAC protocol in TinyOS checksconfliction using DATA/ACK packet. • If no ACK delivered to sender, retransmit the Data

  7. WirelessRF Comm. Component • CC2420RadioC component • GenericComm also is operated byCC2420RadioC component. • CC2420C located in \opt\tinyos‐1.x\tos\lib\CC2420Radio • Basic MAC protocol used in TinyOS runs on CC2420RadioC.

  8. BasicMAC Practice

  9. BasicMAC practice • BasicMAC example • BasicMAC examplesends 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. BasicMAC.nc • 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. 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. 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. 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. BasicMACM.nc • BasicMACM.nc (4) event TOS_MsgPtr ResetCounterMsg.receive (TOS_MsgPtr m) { call Leds.redToggle(); recvNumber++; return m; }

  15. BasicMAC Lab.

  16. BasicMAC Lab 1 • startscygwin 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. 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).

More Related