7/28/2019 Wirelss Sens Nw
1/59
7/28/2019 Wirelss Sens Nw
2/59
Wireless Sensor Networks
Administrivia
BlackBoard Access
Lab Partners
Labs 1, 2, and 3 in Levine 279
Getting started - http://nanork.org/QuickTime and a
TIFF (Uncompressed) decompressor are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
3/59
Wireless Sensor Networks
Previous Lecture
Some Sensor Nodes Application Domains for WSNs Advantages of WSNs Taxonomy of WSNs Batteries and Energy Challenges and Metrics Summary
7/28/2019 Wirelss Sens Nw
4/59
Wireless Sensor Networks
Outline of Todays Lecture
FireFly Hardware Atmel Processor Features Chipcon Radio FireFly Node FireFly Programmer
Operating System Nano-RK Communication Link Layer Tips and Tricks
Lab Descriptions
7/28/2019 Wirelss Sens Nw
5/59
Wireless Sensor Networks
FireFly History
QuickTime and aTIFF (Uncompressed) decompressor
are needed to see this picture.
QuickTime and a
TIFF ( Uncompressed) decompressor are needed to s ee this picture.
QuickTime and aTIFF (Uncompressed) de compressor
are needed to see this picture.
QuickTime an d aTIFF (Uncompressed) decompressor
are need ed to see this picture.
7/28/2019 Wirelss Sens Nw
6/59
Wireless Sensor Networks
FireFly v2.2 - Overview
QuickTime and aTIFF (Uncompressed) decompressor
are neede d to see this picture.
QuickTime and aTIFF (Uncompressed) decompressor are needed to see this picture.
7/28/2019 Wirelss Sens Nw
7/59
Wireless Sensor Networks
Atmel AVRMicrocontrollers
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
7/28/2019 Wirelss Sens Nw
8/59
Wireless Sensor Networks
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
QuickTime and aTIFF ( Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
9/59
Wireless Sensor Networks
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
7/28/2019 Wirelss Sens Nw
10/59
Wireless Sensor Networks
Data Memory 32 8-bit Registers
Compiler (or you) use these for manyinstructions that only operate onregisters
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 loadedand written to and from registers This is slower than directly accessing
a register Program Data, Stack and Heap Live
Here
QuickTime and aTIFF ( Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
11/59
Wireless Sensor Networks
AVR GPIO(General Purpose Input Output)
QuickTime and aTIFF (Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
12/59
Wireless Sensor Networks
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
7/28/2019 Wirelss Sens Nw
13/59
Wireless Sensor Networks
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.
QuickTime and aTIFF ( Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
14/59
Wireless Sensor Networks
GPIO Register
Writing to a Port A memory address directly maps to the state of a port
QuickTime and aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
15/59
Wireless Sensor Networks
GPIO Register
Reading and Writing with a Port
QuickTime and aTIFF (Uncompressed) decompressor
are needed t o see this picture.
7/28/2019 Wirelss Sens Nw
16/59
Wireless Sensor Networks
AVR Analog to Digital Converter
QuickTime and a
TIFF (Uncompressed) decompressor are needed to see t his picture.
7/28/2019 Wirelss Sens Nw
17/59
Wireless Sensor Networks
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)
QuickTime and aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
18/59
Wireless Sensor Networks
AVR UART (Universal AsynchronousReceiver / Transmitter)
QuickTime and aTIFF (Uncompressed) decompressor
are needed to see t his picture.
7/28/2019 Wirelss Sens Nw
19/59
Wireless Sensor Networks
AVR UART
QuickTime and aTIFF ( Uncompressed) decompressor
are needed t o see this picture.
QuickTime an d aTIFF (Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
20/59
Wireless Sensor Networks
AVR SPI and I2C
QuickTime and aTIFF (Uncompressed) decompressor
are need ed to see this picture.
7/28/2019 Wirelss Sens Nw
21/59
Wireless Sensor Networks
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)
QuickTime and aTIFF ( Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
22/59
Wireless Sensor Networks
SPI (Serial Peripheral Interface)
4 Wire Serial Bus from Motorola Up to 1Mbits / sec Bidirectional Data
QuickTime and a
TIFF (Uncompressed) decompressor are needed to see this picture.
QuickTime an d aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
23/59
Wireless Sensor Networks
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
7/28/2019 Wirelss Sens Nw
24/59
Wireless Sensor Networks
Communication Logistics
128-Byte Max Packet Size SPI communication from Atmel to Radio Built-in CRC (cyclic redundancy code) 128-bit AES encryption
QuickTime an d aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
25/59
Wireless Sensor Networks
Horizontal Antenna Pattern
QuickTime and aTIFF (Uncompressed) decompressor
are needed t o see this picture.
7/28/2019 Wirelss Sens Nw
26/59
Wireless Sensor Networks
Vertical Antenna Pattern
QuickTime and aTIFF (Uncompressed) decompressor
are neede d to see this picture.
7/28/2019 Wirelss Sens Nw
27/59
Wireless Sensor Networks
cc2420 Power
QuickTime and aTIFF (Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
28/59
Wireless Sensor Networks
ATmega Power States
QuickTime an d aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
29/59
Wireless Sensor Networks
Radio + CPU Power
QuickTime and aTIFF (Uncompressed) decompressor
are needed t o see this picture.
7/28/2019 Wirelss Sens Nw
30/59
Wireless Sensor Networks
FireFly Board (1/3)
QuickTime and aTIFF (Uncompressed) decompressor
are need ed to see this picture.
7/28/2019 Wirelss Sens Nw
31/59
Wireless Sensor Networks
FireFly Board (2/3)
QuickTime and aTIFF (Uncompressed) decompressor
are neede d to see this picture.
7/28/2019 Wirelss Sens Nw
32/59
Wireless Sensor Networks
FireFly Board (3/3)
QuickTime and aTIFF (Uncompressed) decompressor
are neede d to see this picture.
7/28/2019 Wirelss Sens Nw
33/59
Wireless Sensor Networks
FireFly Programmer
QuickTime and aTIFF (Uncompressed) decompressor
are need ed to see this picture.
7/28/2019 Wirelss Sens Nw
34/59
Wireless Sensor Networks
Connect FireFly board like this...
QuickTime and aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
35/59
7/28/2019 Wirelss Sens Nw
36/59
Wireless Sensor Networks
Software Tools
QuickTime and aTIFF (Uncompressed) decompressor
are needed to see this picture.
>
7/28/2019 Wirelss Sens Nw
37/59
7/28/2019 Wirelss Sens Nw
38/59
7/28/2019 Wirelss Sens Nw
39/59
Wireless Sensor Networks
Nano-RK Architecture
QuickTime an d aTIFF (Uncompressed) decompressor
are needed t o see this picture.
7/28/2019 Wirelss Sens Nw
40/59
Wireless Sensor Networks
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
7/28/2019 Wirelss Sens Nw
41/59
Wireless Sensor Networks
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
7/28/2019 Wirelss Sens Nw
42/59
Wireless Sensor Networks
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
QuickTi me and aTIFF (Uncompre ssed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
43/59
7/28/2019 Wirelss Sens Nw
44/59
Wireless Sensor Networks
Creating a Nano-RK Task
QuickTime an d aTIFF (Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
45/59
Wireless Sensor Networks
Sample nano-RK Task
QuickTime and aTIFF (Uncompressed) decompressor
are need ed to see this picture.
7/28/2019 Wirelss Sens Nw
46/59
Wireless Sensor Networks
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
7/28/2019 Wirelss Sens Nw
47/59
7/28/2019 Wirelss Sens Nw
48/59
Wireless Sensor Networks
LPL-CSMA
QuickTime and aTIFF (Uncompressed) decompressor
are neede d to see this picture.
7/28/2019 Wirelss Sens Nw
49/59
Wireless Sensor Networks
TDMA-based Approach (RT-Link)
QuickTime and aTIFF (Uncompressed) decompressor
are needed to see this picture.
7/28/2019 Wirelss Sens Nw
50/59
Wireless Sensor Networks
RT-Link Graph Coloring
Color Topology Graph to Avoid Collisions Each Color represents a TDMA slot
a
b
d
cf
e
Gateway a
b
d
cf
e
a
b
c
TX
RX
TX
RX
TX
RX
TDMA Frame
Low Power Listen within each
7/28/2019 Wirelss Sens Nw
51/59
Wireless Sensor Networks
Low Power Listen within eachTDMA Slot
QuickTime and a
TIFF (Uncompressed) decompressor are needed to see this picture.
7/28/2019 Wirelss Sens Nw
52/59
Wireless Sensor Networks
Receiving a Packet with Nano-RK
QuickTime and aTIFF (Uncompressed) decompressor
are needed to s ee this picture.
7/28/2019 Wirelss Sens Nw
53/59
Wireless Sensor Networks
Sending a Packet with Nano-RK
QuickTime and aTIFF (Uncompressed) decompressor
are needed t o see this picture.
7/28/2019 Wirelss Sens Nw
54/59
Wireless Sensor Networks
RT-Link Schedule
QuickTime an d aTIFF (Uncompressed) decompressor
are needed t o see this picture.
QuickTime an d aTIFF (Uncompressed) decompressor
are need ed to see this picture.
7/28/2019 Wirelss Sens Nw
55/59
7/28/2019 Wirelss Sens Nw
56/59
7/28/2019 Wirelss Sens Nw
57/59
d k ( f )
7/28/2019 Wirelss Sens Nw
58/59
Wireless Sensor Networks
Tips and Tricks (4 of 4)
What variables are using up my memory? Use avr-nm (NAME) to find a list of symbols and how much
they consume. Below is an example that prints the size of functions and static memory sorted as decimal:
"T" refers to the text section, "B" refers to the BSSsection, and "D" refers to the data section.Remember that strings don't show up in this listbecause they do not have compiler mapped labels.
QuickTime and aTIFF (Uncompressed) decompressor
are needed t o see this picture.
7/28/2019 Wirelss Sens Nw
59/59
Questions?
On Tuesday:
Labs and Get started with nano-RK Other Operating Systems