1 / 31

TinyOS Programming Boot Camp Part III: Hardware Tour

TinyOS Programming Boot Camp Part III: Hardware Tour. David Culler, Jason Hill, Rob Szewczyk, Alec Woo U.C. Berkeley 2/9/2001. Hardware Tour. Outline. Design overview Connector bus Sensor motherboard Sensor boards Supporting hardware Resources. Design Rationale.

maj
Télécharger la présentation

TinyOS Programming Boot Camp Part III: Hardware Tour

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. TinyOS Programming Boot Camp Part III: Hardware Tour David Culler, Jason Hill, Rob Szewczyk, Alec Woo U.C. Berkeley 2/9/2001

  2. Hardware Tour

  3. Outline • Design overview • Connector bus • Sensor motherboard • Sensor boards • Supporting hardware • Resources

  4. Design Rationale • Want to experiment with a wide variety of sensors • Need a wide variety of interfaces, analog and digital • Sensor platforms should be easy to design • Want to preserve processor and communication module • Major investment in SW and programming environment • Want interoperability between the various types of sensors • Every sensor node needs communication to be useful • Need a fixed interface to match the sensor modules with processor and communication

  5. Design Rationale • Main board requirements • Easy to program and debug • Need an easy access to most signals in the system • Need standard interfaces • Basic self-monitoring and maintenance capability • Ability to reprogram remotely • Ability to control radio cell size • Ability to monitor signal strength • Other self monitoring added on sensor packs • Sensor requirements • Digital serial interfaces • Analog sensor support • Ability to control on/off state of individual sensors

  6. Mote Connector Schematics

  7. Mote Expansion Connector • Documented hardware interface • Swap components on either side of the connector while preserving investment in sensors or main boards • Sensor interfaces • 4 lines dedicated to switching components on and off • 7 analog voltage sensing lines • 2 I2C busses • SPI • UART lines • Debugging aids • All radio-related signals: RX, TX, base band, control signals, signal strength • Programming interfaces • SPI and reset signals for the main processor and the coprocessor • Ground, Vcc for both analog and digital circuits • 12 lines reserved for future use

  8. Power Lines • Need to control on/off state of individual sensors • Independently switched, used as outputs • Capability • Sink up to 20 mA, source a bit less • If more current is required by a sensor circuit, use MOSFETs • No higher level protocol attached • The place to implement functionality not provided by standard interfaces

  9. Analog Lines and AD Conversion • Most sensors provide an analog interface • Simple voltage dividers with photo resistors, thermistors, etc. • Whetstone bridges, condenser microphones, etc. • Need analog voltage sensing lines • 10 bit ADC,  2 LSB=> 8 usable bits •  3 mV error • Rail-to-rail range • Sampling rate • Max 15.4 ksps in continuous sampling mode • Max 4 ksps in a single sampling mode • 8 multiplexed channels • One dedicated to sampling BBOUT • Sampling rate high enough for most environmental phenomena • Interrupt driven, or polling version

  10. I2C Bus • 2-wire serial bus: clock and data • Clock is an “or” of all clock generators, the slowest clock generator dictates the speed • Bi-directional data line • Higher level protocol than UART or SPI • Defines a protocol for multiple device access, up to 128 devices per bus • Defines a multiple master arbitration • Allows for multi-byte transactions • Speed: up to 400 kbps • Software implementation • Soft timing constraints mean that the use of timers is not mandatory, use tasks instead • Either 1 bit or 1 byte per task • Many slave devices available • EEPROM used for logging and other permanent storage • IO extenders, ADC converters, sensors, etc.

  11. SPI • 3-wire, full duplex serial bus: clock, MISO, MOSI • Connector bus defines 2 SPI busses • Speed: up to 1 mbps • Hardware support on the main processor, software implementation on the coprocessor • Low-voltage programming interface to ATMEL microcontrollers • Interaction with coprocessor • Cyclic 16 bit distributed register

  12. UART • A standard way for exchanging information with a PC • Voltage conversion and connector required, provided by the programming board • Available speed: 2400 bps to 115 kbps • Most reliable for communication with PC: 19.2 kbps • Large clock rate errors at high sending rates • 1 byte FIFOs • Hardware doesn’t buffer multiple bytes of either input or output • Operate in either polling or interrupt driven mode • TinyOS uses UARTs in interrupt driven mode

  13. Rene: the Motherboard • Main components • Processor: ATMEL AVR 90LS8535 • Reprogramming coprocessor • Short range radio • LEDs • I2C EEPROM

  14. Rene Schematics

  15. AVR Processor Core • Clock speed: 4 MHz • Memory • 8 Kbytes of program memory (flash) • 512 bytes of data RAM • 512 bytes of EEPROM on chip (write: 4 ms/byte) • 32 8 bit registers • IO capabilities • 32 general purpose IO lines • Some lines also serve more specialized purposes, e.g. UART • 10-bit 8-channel ADC • Connector interface means that the IO lines serve a more specific purposes • Interrupts • No external interrupts available • No interrupt queuing

  16. AVR Processor Core • Timers • 8 bit timer/counter – unused in current applications • 16 bit counter – one comparator used for radio sampling, other functions unused • 8 bit, externally clocked timer/counter – used for periodic sampling of sensors and sleep control • More advanced timer features (input capture, PWM output) are available, through not explicitly allocated on the connector, use at your own risk • Power consumption • Restrictions • No truly general purpose registers • Limited arithmetic/logic instructions

  17. Programming the Processor • Program the runtime memory image into a flash • No loader, no dynamic linker • Programming steps • Extract the code and data segments from an executable into an SREC file • Erase the current contents of the flash • Reset the processor • Download the program • Serial download protocol • Each download command contains the address, and the contents of to be stored • 10 ms delay per byte of code • Verify the program: read the flash, match it against the source image • After reset, start executing C runtime • No ability to write the flash on the fly • Requires a coprocessor for reprogramming

  18. Coprocessor Circuit • Coprocessor: ATMEL AVR AT90S2343 • 2 Kbytes of code space • 1 MHz internal clock • Required connections • SPI for programming the main microcontroller • RESET for the main controller • I2C for accessing EEPROM storage • Insufficient pins – I2C and SPI clock lines are shared • Minimal capability • Software SPI • Software I2C

  19. Radio Circuit • RFM Monolithics TR1000 916 MHz radio • On/off keying at 10 kbps (max. 19.2 kbps) • Capable of 115 kbps using amplitude shift keying • Capable of turning on in 30 us • Low-power listening by switching on and off on a sub-bit granularity • Processor interface • RFM CNTRL 0 and 1 – switch between transmit, receive, and sleep • Raw, unbuffered access to transmit (RFM TX) and receive (RFM RX) • Requires DC balanced signal – an equal number of 1’s and 0’s in the signal • Sampling on reception and modulating on transmission done is software • Too much noise in received signal to use UART for sampling • too little flexibility offered by UART • Imposes real time constraints on the system • Power usage • Transmit current: 7 mA • Receive current: 4.5 mA • Sleep: 5 uA

  20. Radio Signal Strength • Measuring the quality of reception from a node is useful • Aid in multihop routing decisions • Help with location estimation • Signal strength measurement • Based on base band sampling • Demodulated and amplified analog signal, fed into ADC channel 0 • Raw samples further processed in TinyOS • Empirical evaluation* *Klemmer, Waterson, Whitehouse, 2000

  21. Radio Transmission Strength Control • Useful in networking experiments • Control the cell size • Allow for power savings • Principles of operation • Radiated power is proportional to the square of the current on RFM TX pin • Signal strength control • Controlled through a digital potentiometer (DS 1804), 0-50 kOhms • Currently no observable effects on power usage • Evaluation • Optimal transmission at the pot setting of 10 kOhms • Changing the range from 45 to 90 feet in an indoor environment • Changing the transmit strength has no effect on power usage • Effects secondary to shape/length of the antenna

  22. LEDs • Basic mote UI and a great debugging tool • Power consumption: 6mA • LED consumes as much power as the main microcontroller • If power is a concern, turn them off! • LED 1 and LED 2 multiplexed with the signal strength potentiometer control • Use them for controlling any other DS 1804 pots, one at a time

  23. Matching SW and HW: hardware.h • Define a hardware.h for each motherboard • Map motherboard abstractions onto physical pins • RFM RX, TX, and control pins • Allocate the connector pins onto the motherboard resources: PW lines, I2C busses, UARTs, etc. • Define a header file for each sensor board • Assign symbolic names (e.G. PHOTO_PWR) to the connector signals • Attempt to maintain a consistent convention in hardware design • Photo and temperature on the same signals in both basic and advanced boards

  24. Mote Connector Caveats • Multipurpose lines • LED1 and LED2 are used to control the signal strength potentiometer. They can also be used to control digital pots on sensor boards • PW3 can be used as a PWM output • PW4 can be used as a timer input capture, useful for PWM inputs • Other restrictions • Relationship between the main processor and the coprocessor dictates that their SPI busses are permanently connected • Shortage of pins on the coprocessor dictates that the SPI SCK is shared with the I2C BUS 2 CLK • Cannot use this bus when the board is plugged into the programming port • Cannot use the logging component when a board is set up for programming

  25. Basic Sensor Board • Sensors • Photo resistor – PW1 and ADC1 • Thermistor – PW2 and ADC2 • Prototyping area

  26. Vibes Sensor Board • Vibes • Photo resistor: PW1 and ADC1 • Thermistor: PW4, ADC6 • 2 axis accelerometer: ADC2 and 3, PW2 • Digital temperature: I2C Bus 1

  27. 2xMAG Board • Sensor • 2 axis magnetometer optimized for vehicle detection • Resources: PW2, 3, and 4, ADC 6 and 7

  28. Programming Board • SPI interface through the parallel port • Programming either the main microcontroller or the coprocessor with a flip of the switch • RS232 connector • Voltage conversion • CTS/RTS signal grounded • Program the serial port accordingly

  29. Building Your Own • Tools • OrCAD – capture and layout tools • Complete designs • Rene • Basic • Vibes • 2xMAG • Base board

  30. Resources • Datasheets • ATMEL 8535 datasheet • RFM TR1000 datasheet • 24WC256 EEPROM • ADXL202 2 axis accelerometer • HMC1002 2 axis magnetometer • Schematics • Rene motherboard • Basic sensor board • Vibration sensor board • Vehicle detection board • Base board • Debugging board

  31. Exercise • Basic sensor modification • Add a buzzer to the basic sensor board • Connect buzzer to Vcc and to an unused PW line. The buzzer should turn on when pulled PW is pulled low • Write a component to interface with a buzzer • Use a similar component as a template • Using the previous application as a template, create an application which beeps when the average light level drops below some threshold (audience choice)

More Related