Serial Programming/Forming Data Packets
From Wikibooks, the open-content textbooks collection
Serial Programming: Introduction and OSI Network Model -- RS-232 Wiring and Connections -- Typical RS232 Hardware Configuration -- 8250 UART -- DOS -- MAX232 Driver/Receiver Family -- TAPI Communications In Windows -- Linux and Unix -- Java -- Hayes-compatible Modems and AT Commands -- Universal Serial Bus (USB) -- Forming Data Packets -- Error Correction Methods -- Two Way Communication -- Packet Recovery Methods -- Serial Data Networks -- Practical Application Development -- IP Over Serial Connections
< Programming:Serial Data Communications
Just about every idea for communicating between computers involves "data packets", especially when more than 2 computers are involved.
The idea is very similar to putting a check in an envelope to mail to the electricity company. We take the data (the "check") we want to send to a particular computer, and we place it inside an "envelope" that includes the address of that particular computer.
A packet of data starts with a preamble, some address information, some other transmission-related information, followed by the raw data, and finishes up with a few more bytes of transmission-related error-detection information (often a Fletcher-32 checksum ).
The accountant at the electricity company throws away the envelope when she gets the check. She already knows the address of her own company. Does this mean the "overhead" of the envelope is useless ? No.
In a similar way, once a computer receives a packet, it immediately throws away the preamble. If the computer sees that the packet is addressed to itself, and has no errors, then it discards the wrapper and keeps the data.
Unfortunately, there are dozens of slightly different, incompatible protocols for data packets, because people pick slightly different ways to represent the address information and the error-detection information.
... gateways between incompatible protocols ...
[edit] For further reading
- Optical and radio receivers usually require a preamble of some minimum length in order to synchronize bit clocks. For detailed information on calculating exactly how long (how many transitions) the preamble needs to be, see Clock and data recovery/Design values used in practice/Burst transmission mode/Step response of a phase aligner.
- http://intcomm.wiki.taoriver.net/moin.cgi/ProtocolMadness
- UDP
- Internet Technologies/Protocols including TCP/IP and HTTP
- ATM
- VSCP - Very Simple Control Protocol http://www.vscp.org/ "The protocol is free"
- "Protocol Design Folklore" by Radia Perlman. Jan 15, 2001. http://www.awprofessional.com/articles/article.asp?p=20482
- "Devices that play together, work together: UPnP defines common protocols and procedures to guarantee interoperability among network-enabled PCs, appliances, and wireless devices." article by Edward F Steinfeld, EDN, 9/13/2001 http://www.reed-electronics.com/ednmag/index.asp?layout=article&articleid=CA154802&spacedesc=readersChoice&rid=0&rme=0&cfd=1
- CAN bus http://computer-solutions.co.uk/ http://computer-solutions.co.uk/gendev/can-module.htm
- "CMX-MicroNet is the first system that allows TCP/IP
- and other protocols to be run natively on small processors
- ... [including] AVR, PIC 18, M16C."
- "byteflight is a high speed data bus protocol for automotive applications" http://byteflight.com/
- Nagle's rule ... The Nagle algorithm. "Nagle's rule is a heuristic to avoid sending particularly small IP packets, also called tinygrams. Tinygrams are usually created by interactive networking tools that transmit single keystrokes, such as telnet or rsh. Tinygrams can become particularly wasteful on low-bandwidth links like SLIP. The Nagle algorithm attempts to avoid them by holding back transmission of TCP data briefly under some circumstances." -- http://www.tldp.org/LDP/nag/node45.html
- The SLIMP3 Client Protocol
- Beej's Guide to Network Programming Using Internet Sockets by Brian "Beej" Hall 2005-11-05
- "RF Link Using the Z86E08" describes yet another "simple" packet protocol ... also mentions a preamble to train the RF receiver just before the rest of the packet.
- Algorithm Implementation/Checksums
- ... other packet protocols ? ...