Difference between revisions of "Controller v2"

From 3D printer from scratch
Jump to: navigation, search
(Created page with "= UART-based Controller = Command Format Framing * 1 byte frame length * n byte frame data * 2 byte crc16 (CCITT) of frame data")
 
(UART-based Controller)
Line 3: Line 3:
 
Command Format
 
Command Format
  
Framing
+
== Framing ==
  
* 1 byte frame length
+
The framing is self synchronizing. Each frame ends with an EOF marker. Everywhere else the EOF marker is escaped.
 +
 
 +
=== Frame Format ===
 +
 
 +
* 1 byte sequence number
 
* n byte frame data
 
* n byte frame data
 
* 2 byte crc16 (CCITT) of frame data
 
* 2 byte crc16 (CCITT) of frame data
 +
* 0x7e as EOF marker
 +
 +
=== Escaping ===
 +
 +
Escaping is done by byte stuffing. Escape character is 0x7d. Bytes to be escaped are 0x7d and 0x7e. The escape character is following by the byte to by escaped XOR 0x20.

Revision as of 14:55, 29 July 2018

UART-based Controller

Command Format

Framing

The framing is self synchronizing. Each frame ends with an EOF marker. Everywhere else the EOF marker is escaped.

Frame Format

  • 1 byte sequence number
  • n byte frame data
  • 2 byte crc16 (CCITT) of frame data
  • 0x7e as EOF marker

Escaping

Escaping is done by byte stuffing. Escape character is 0x7d. Bytes to be escaped are 0x7d and 0x7e. The escape character is following by the byte to by escaped XOR 0x20.