28.12.2013 Views

Serial Programming - upload.wikimedia....

Serial Programming - upload.wikimedia....

Serial Programming - upload.wikimedia....

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

See also<br />

in 4B5B coding, 8b/10b encoding; etc. Other systems, such as 9-bit protocols, 891011121314<br />

transmit 9 bit symbols. Typically the first 9-bit symbol of a packet has its high bit set to 1,<br />

waking up all nodes; then each node checks the destination address of the packet, and all<br />

nodes other than the addressed node go back to sleep. The rest of the data in the packet<br />

(and the ACK response) is transmitted as 9 bit symbols with the high bit cleared to 0,<br />

effectively 8 bit values, which is ignored by the sleeping nodes. (This is similar to the way<br />

that all data bytes in a MIDI message are effectively 7 bit values; the high bit is set only on<br />

the first byte in a MIDI message). Alas, some UARTs make it awkward, 1516 difficult, or<br />

impossible to send and receive such 9-bit characters.<br />

Some communication protocols break "unique start" -- i.e., they allow the no-longer-unique<br />

start-of-packet symbol to occur elsewhere -- most often because we are sending a file that<br />

includes that byte, and "simple copy" puts that byte in the data payload. When a receiver is<br />

first turned on, or when cables are unplugged and later reconnected, or when noise corrupts<br />

what was intended to be the real start-of-packet symbol, the receiver will incorrectly interpret<br />

that data as the start-of-packet. Even though the receiver usually recognizes that something<br />

is wrong (checksum failure), a single such noise glitch may lead to a cascade of many lost<br />

packets, as the receiver goes back and forth between (incorrectly) interpreting that data byte<br />

in the payload as a start-of-packet, and then (incorrectly) interpreting a real start-of-packet<br />

symbol as payload data.<br />

In order to keep the "unique start" feature, many communication protocols break "simple<br />

copy". This requires a little extra software and a little more time per packet than simply<br />

copying the data -- which is usually insignificant with modern processors. The awkwardness<br />

comes from (a) making sure that the entire process -- the transmitter encoding/escaping<br />

a chunk of raw data into a packet payload that must not include the start-of-packet byte,<br />

and the receiver decoding/unescaping the packet payload into a chunk of raw data -- is<br />

completely transparent to any possible sequence of raw data bytes, even if those bytes<br />

include one or more start-of-packet bytes, and (b) since the encoded/escaped payload data<br />

inevitably requires more bytes than the raw data, we must make sure we don't overflow<br />

any buffers even with the worst possible expansion, and (c) unlike "simple copy" where a<br />

constant bitrate of payload data bits results in the same constant goodput of raw data bits,<br />

we must make sure that the system is designed to handle the variations in payload data<br />

8 uLan ˆ{http://ulan.sourceforge.net/} : 9-bit message oriented communication protocol, which is<br />

transferred over RS-485 link.<br />

9 Pavel Pisa. "uLan RS-485 Communication Driver" ˆ{http://cmp.felk.cvut.cz/~pisa/ulan/ul_drv.<br />

html} "9-bit message oriented communication protocol, which is transferred over RS-485 link."<br />

10 Peter Gasparik. "9-bit data transfer format" ˆ{http://www.rtjcom.com/6811/jackpot/<br />

rs485-commspec.html#3}<br />

11 Stephen Byron Cooper. "9-Bit <strong>Serial</strong> Protocol" ˆ{http://www.ehow.com/facts_7735117_<br />

9bit-serial-protocol.html} .<br />

12 "Use The PC's UART With 9-Bit Protocols" ˆ{http://electronicdesign.com/article/embedded/<br />

use-the-pc-s-uart-with-9-bit-protocols6245.aspx} . 1998.<br />

13 Wikipedia: multidrop bus ˆ{http://en.wikipedia.org/wiki/%20multidrop%20bus} (MDB) is a 9-bit<br />

protocol used in many vending machines.<br />

14 ParitySwitch_9BitProtocols ˆ{http://www.docklight.de/examples_en.htm} : manipulate parity to<br />

emulate a 9 bit protocol<br />

15 "Use The PC's UART With 9-Bit Protocols" ˆ{http://electronicdesign.com/article/embedded/<br />

use-the-pc-s-uart-with-9-bit-protocols6245.aspx} . Electronic Design. 1998-December.<br />

16 Thomas Lochmatter. "Linux and MARK/SPACE Parity" ˆ{http://www.lothosoft.ch/thomas/<br />

libmip/markspaceparity.php} . 2010.<br />

111

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!