slide 1 worstell@ copper.net robust low-power msp430 networking with a buffer insertion ring glen...
TRANSCRIPT
Slide 1
Robust Low-Power MSP430 Networking with aBuffer Insertion Ring
Glen Worstell
Sugle Consulting
More info:
www.worstell.com
Slide 2
• Application areas for small networks
• Common small network solutions
• The “Buffer Insertion Ring” network Protocol MSP430 Hardware MSP430 Software
• Comparison of BIR with other solutions
• Description of BIR demonstration code
• Q&A
Slide 3
[email protected] network applications
• Auto and other vehicle data & control LIN commonly used
• Industrial process control
• Lab data collection
• Home automation
• Medical data collection
• HVAC
Slide 4
[email protected] Micro Networks
• CAN Multi-Master 1Mbps 8 Byte Messages
• LIN Master-Slave (sort of) 20K bps 8 Byte Messages
• BIR Multi-Master 50K bps 8 Byte Messages
• Home-grown RS-485
Slide 5
[email protected] BIR?
Extremely low idle power Isolated (with isolated power supply) Lowest cost, esp. in small quantities Uses available hardware (UART) Low EMI generation Low EMI susceptibility Multi-master Can use with other micros (but not low power)
Slide 6
[email protected] not BIR?
• Can’t disable interrupts for very long But could use 2nd MSP430
• Requires Xtal But could use LIN-like scheme
• 1 Byte latency per node About 1 Msec per node at 10K baud
Slide 7
[email protected] Concept
• Unique node numbers
• Node sends message (to all other nodes) whenever necessary
• Asynchronous serial node transceivers Built-in UART Bit-Bang (F1121)
• 4-Wire Cable (RJ-11?) Power, Ground Balanced pair BIR data 2 to 32 nodes
• Optical Isolators
Slide 8
[email protected] message format
Slide 9
[email protected] Hardware
Slide 10
[email protected]/byte Message Format
• Address Byte Node Number of Sender (5 bits) Number of Data Bytes (2 bits) Parity (1 bit)
• Data Byte (8 bits)
• Extra Data Bytes (8 bits each)
• Checksum (8 bits, like LIN or CRC-8)
Slide 11
[email protected] of Data Bytes Coding
• 0: One Data Byte
• 1: Two Data Bytes
• 2: Four Data Bytes
• 3: Eight Data Bytes
Slide 12
[email protected] Buffer Idea
• Each node has a buffer
• Incoming data goes in buffer
• To Send: If buffer is empty, put message into buffer Otherwise, wait until it is empty
• Messages from other nodes are passed on
• Messages from this node are not passed
• A note about baud rate divisors If small n, n should be odd
Slide 13
[email protected] software flowchart
Slide 14
[email protected] Three-node Demo
• Each node sends to a random other node
• Sending occurs at random intervals
• Random message:” turn on LED” or “turn off LED”
• Stop blinking for one minute if any error is detected
• Source code on web
• Uses simple RTOS and “Random” number generator
Slide 16
[email protected] RTOS for limited RAM
• Single Stack
• Cooperative
• Standard C
• See “Salvo” for similar scheme
• Source code on web www.worstell.com
Slide 17
[email protected] RTOS idea
• Suspend only from Main()
• Nothing is on the stack
• Need to save only the return address
• See “ProtoThreads”, Adam Dunkels, www.sics.se/~adam/pt/
Slide 18
A good PRNG without hardware multiply• Poor PRNGs are very common
Feedback shift registers arithmetic modulo a power-of-2
• “Random Number Generators - Good Ones are Hard to Find” Park ,SK & KW Miller, CACM, Oct. 1998 X(n+1) = (A*X(n)+B) mod M
• Multiplicative, Congruential Random-Number Generators with Multiplier +- 2^K1 +- 2^K2 and Modulus 2^P - 1, Pei Chi Wu, ACM Trans. On Mathematical Software, June 1977