1 / 59

ESE680: Wireless Sensor Networks Special Topics in Embedded Systems The FireFly Platform

ESE680: Wireless Sensor Networks Special Topics in Embedded Systems The FireFly Platform Programming FireFly and the Nano-RK Sensor OS Lecture #3. Prof. Rahul Mangharam. Administrivia. BlackBoard Access Lab Partners Labs 1, 2, and 3 in Levine 279 Getting started - http://nanork.org/.

olesia
Télécharger la présentation

ESE680: Wireless Sensor Networks Special Topics in Embedded Systems The FireFly Platform

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. ESE680: Wireless Sensor Networks Special Topics in Embedded Systems The FireFly Platform Programming FireFly and the Nano-RK Sensor OS Lecture #3 Prof. Rahul Mangharam Wireless Sensor Networks

  2. Administrivia • BlackBoard Access • Lab Partners • Labs 1, 2, and 3 in Levine 279 • Getting started - http://nanork.org/ Wireless Sensor Networks

  3. Previous Lecture • Some Sensor Nodes • Application Domains for WSNs • Advantages of WSNs • Taxonomy of WSNs • Batteries and Energy • Challenges and Metrics • Summary Wireless Sensor Networks

  4. Outline of Today’s Lecture • FireFly Hardware • Atmel Processor Features • Chipcon Radio • FireFly Node • FireFly Programmer • Operating System • Nano-RK • Communication Link Layer • Tips and Tricks • Lab Descriptions Wireless Sensor Networks

  5. FireFly History Wireless Sensor Networks

  6. FireFly v2.2 - Overview Wireless Sensor Networks

  7. Atmel AVR Microcontrollers • FireFly 1.2 Atmega32 (2K SRAM, 32K FLASH, 4K EEPROM) • FireFly 2.0 Atmega128 (4K SRAM, 128K FLASH, 4K EEPROM) • FireFly 2.2 Atmega1281 (8K SRAM, 128K FLASH,4K EEPROM) ATmega1281 Features • 1 I2C controller (2 wire serial protocol, Philips) • 8-bit Harvard Architecture (16-bit address space) • RISC Instruction Set • 2 UARTS (RS232 115200 baud) • 1 SPI (4 wire serial protocol, Motorola) • 8 channel 10-bit ADC • 2 8 bit Timers / Counters • 4 16 bit Timers / Counters • 6 Full 8-bit GPIO ports • 32 8-bit Registers • 64 Control Registers Wireless Sensor Networks

  8. Atmel AVR CPU Core • No Cache • No Pre-Fetch • No Branch Predictor • No Memory Management Unit • Yes Pipeline (Hooray 1962!) • VERY Little RAM • Reasonable ROM Wireless Sensor Networks

  9. AVR On Chip Memory • SRAM (8K) • Holds Program Data etc • Cleared on Power Down • FLASH Memory (128K) • Holds Program Code • Does not get cleared on power down, but is slow for a program to write into (must write large pages) • Limited write cycle lifetime • EEPROM (4K) • Does not get cleared on power down • Easy for a program to read / write from • Uses interface that reads / writes to control registers • FUSES (a few bytes) • Holds CPU Hardware Configuration • CPU can not access this data Wireless Sensor Networks

  10. Data Memory • 32 8-bit Registers • Compiler (or you) use these for many instructions that only operate on registers • 64 8-bit I/O Registers (all named in a header file) • Control UART parameters • Set / Read Pin Values • Configure Timers • Internal SRAM • This is memory that must be loaded and written to and from registers • This is slower than directly accessing a register • Program Data, Stack and Heap Live Here Wireless Sensor Networks

  11. AVR GPIO(General Purpose Input Output) Wireless Sensor Networks

  12. General Purpose Input-Output • Tri-state Buffer Port • Memory-Mapped IO • Control Registers • Data Direction Register (DDR, TRIS) • Internal Pull Up Register (PLP) • Reading / Writing to the Port Wireless Sensor Networks

  13. Tri-state Buffer Gate(controlled by DDR register) • Each GPIO port can be configured as input or output on a bit-by-bit basis. • Input can act as a high-impedance state to allow other devices to control the line level. Wireless Sensor Networks

  14. GPIO Register • Writing to a Port • A memory address directly maps to the state of a port Wireless Sensor Networks

  15. GPIO Register • Reading and Writing with a Port Wireless Sensor Networks

  16. AVR Analog to Digital Converter Wireless Sensor Networks

  17. AVR Analog to Digital Converter • Converts an Analog Signal to a Digital One • 8 Channels at 10 bit Resolution • Sampling Rate (up to 15 kSPS) Wireless Sensor Networks

  18. AVR UART (Universal Asynchronous Receiver / Transmitter) Wireless Sensor Networks

  19. AVR UART Wireless Sensor Networks

  20. AVR SPI and I2C Wireless Sensor Networks

  21. I2C (Inter-Integrated Circuit) • Multi-drop 2 wire serial bus protocol • Designed by Philips • Two Bi-directional Open-Drain Lines • 400 kbits / sec (up to 3.4Mbits / sec high speed mode) Wireless Sensor Networks

  22. SPI (Serial Peripheral Interface) • 4 Wire Serial Bus from Motorola • Up to 1Mbits / sec • Bidirectional Data Wireless Sensor Networks

  23. Radio (TI-Chipcon cc2420) • 802.15.4 Radio • Physical / MAC layer of Zigbee • 2.4 Ghz (ISM band) • 250 Kbps (Burst Data Rate) • 16 Channels (11-26) in 5MHz Steps • Transmits > 100 meters line of sight • 0.18µ CMOS Process Wireless Sensor Networks

  24. Communication Logistics • 128-Byte Max Packet Size • SPI communication from Atmel to Radio • Built-in CRC (cyclic redundancy code) • 128-bit AES encryption Wireless Sensor Networks

  25. Horizontal Antenna Pattern Wireless Sensor Networks

  26. Vertical Antenna Pattern Wireless Sensor Networks

  27. cc2420 Power Wireless Sensor Networks

  28. ATmega Power States Wireless Sensor Networks

  29. Radio + CPU Power Wireless Sensor Networks

  30. FireFly Board (1/3) Wireless Sensor Networks

  31. FireFly Board (2/3) Wireless Sensor Networks

  32. FireFly Board (3/3) Wireless Sensor Networks

  33. FireFly Programmer Wireless Sensor Networks

  34. Connect FireFly board like this... Wireless Sensor Networks

  35. FireFly Programmer • Download Firmware Image to Board • Read and Write Serial Debugging Data • TimeScope • 4 channel code execution profiler (good for setting OS reserves) Wireless Sensor Networks

  36. Software Tools > Wireless Sensor Networks

  37. Operating Systems • TinyOS (Berkeley) • Event Based Operation • Not Multi-threaded • nesC programming language • SOS (UCLA) • Cooperative Multi-tasking • Loadable Modules • Mantis (Colorado) • Preemptive Multi-tasking • Nano-RK (CMU/Penn) • Preemptive Priority Based Multi-tasking • RK (“Resource Kernel”) Wireless Sensor Networks

  38. Nano-RK Features • C GNU tool-chain • Classical Preemptive Operating System Multitasking Abstractions • Real-Time Priority-Based Scheduling • Rate Monotonic Scheduling • Built-in Fault Handling • Energy-Efficient Scheduling based on a priori task-set knowledge Wireless Sensor Networks

  39. Nano-RK Architecture Wireless Sensor Networks

  40. Nano-RK Reservations • CPU Utilization • Time Allowed Per Period • For example, a task can run for 10ms of time every 250ms • Network Utilization • Packets In and Out Per Period • Sensors & Actuators Usage • Sensor Readings Per Period • {CPU, Network, Peripherals} • Together comprise the total energy usage of the node • Static Offline Budget Enforcement Wireless Sensor Networks

  41. Nano-RK Time Management • ~1ms OS Tick Resolution • Variable Tick Timer (interrupts occur as required, not every quantum) • wait_until_xxx() functions • Suspend task until the event or timeout happens • If there is no wait_until_xxx() call, then your reserve will be violated • If reserves are disabled, then this can starve low priority tasks and will waste battery power Wireless Sensor Networks

  42. Nano-RK Fault Handling • Task Time Violations • OS will enforce time bounds given to a task • Canary Stack Check • Check if user-specified stack has been overflowed • Not 100%, but incurs low overhead and better than nothing • Unexpected Restarts • Capture restart that occurs without power-down • Resource Over-use • Manage sensors / actuators • Low Voltage Detection • Watchdog Timer Wireless Sensor Networks

  43. Nano-RK Task Set (nrk_cfg.h) Wireless Sensor Networks

  44. Creating a Nano-RK Task Wireless Sensor Networks

  45. Sample nano-RK Task Wireless Sensor Networks

  46. Nano-RK Network: Link Layers • LPL-CSMA (bmac) • Low-Power Listen Carrier Sense Multiple Access • Contention Based Protocol • Polastre, Hill, Culler, “Versatile Low Power Media Access for Wireless Sensor Networks”, Sensys 2004 • RT-Link • Time Division Multiple Access (TDMA) Protocol • Anthony Rowe, Rahul Mangharam, Raj Rajkumar, "RT-Link: A Time-Synchronized Link Protocol for Energy Constrained Multi-hop Wireless Networks," SECON 2006 Wireless Sensor Networks

  47. LPL-CSMA • Low-Power Listen Carrier Sense Multiple Access (LPL-CSMA) schemes • Tradeoff: Check Faster or Listen Longer Wireless Sensor Networks

  48. LPL-CSMA Wireless Sensor Networks

  49. TDMA-based Approach (RT-Link) Wireless Sensor Networks

  50. RT-Link Graph Coloring TX RX TX RX TX RX • Color Topology Graph to Avoid Collisions • Each Color represents a TDMA slot a a a Gateway f f c c b b b e e d d c TDMA Frame Wireless Sensor Networks

More Related