slide 1 worstell@ copper.net robust low-power msp430 networking with a buffer insertion ring glen...

19
Slide worstell @copper. net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting [email protected] More info: www.worstell.com

Upload: peregrine-charles

Post on 18-Jan-2016

218 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 1

[email protected]

Robust Low-Power MSP430 Networking with aBuffer Insertion Ring

Glen Worstell

Sugle Consulting

[email protected]

More info:

www.worstell.com

Page 2: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 2

[email protected]

• 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

Page 3: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 4: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 5: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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)

Page 6: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 7: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 8: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 8

[email protected] message format

Page 9: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 9

[email protected] Hardware

Page 10: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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)

Page 11: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 11

[email protected] of Data Bytes Coding

• 0: One Data Byte

• 1: Two Data Bytes

• 2: Four Data Bytes

• 3: Eight Data Bytes

Page 12: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 13: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 13

[email protected] software flowchart

Page 14: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 15: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 15

[email protected] photo

• BIR demo - 2 HW UART, 1 Timer-A UART

Page 16: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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

Page 17: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

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/

Page 18: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 18

[email protected]

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

Page 19: Slide 1 worstell@ copper.net Robust Low-Power MSP430 Networking with a Buffer Insertion Ring Glen Worstell Sugle Consulting worstell@copper.net More info:

Slide 19

[email protected]&A

• Email: [email protected]

• More info, source code: www.worstell.com