Simple UART communication protocol in XOD

Concept

Nodes overview

Packet node

  • SIZE pin — specifies the size for the package. Note, that this value determines the size of the whole package, not just the part that contains your data. For example, to send a packet with 3 values, you need a 5-sized packet, because you also need a 2-byte space for a “header” and “checksum”.
  • PCKT pin — outputs the packet custom type value for a created packet.

Add-head node

Add-byte-to-packet node

Add-checksum node

Send-packet node

  • UART — the pin of the custom UART type for an interface you use.
  • PCKT — the pin for the packet to be sent.
  • SEND — the pin that triggers a new packet sent.
  • DONE — the pin fires on a successful packet sent.
  • ERR — the pin fires on a failed packet sent.

Read-packet node

  • BYTE — the pin for an incoming byte.
  • PUSH— triggers a new “header” match.
  • HEAD — a “header” hexadecimal value of a byte type, for example 20h. Note, that the “header“ byte values should be equal on the receiving and sending sides.
  • DONE — fires if a “header” is found.

Check-packet node

  • CHCK — triggers a new packet check.
  • CSB — A “checksum” byte of your packet is calculated with this unique CSB byte. Note, that the “checksum“ byte values should be equal on the receiving and sending sides.
  • OK — fires if a packet arrived undamaged.
  • BAD— fires on a broken packet.

Get-byte-from-packet node

  • IDX— sequence number of the byte to pull from a packet.
  • GET — triggers a new pull of a byte.

Example

Sending side

Receiving side

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store