Simple UART communication protocol


#1

Hi everyone!

Check out my new library for creating a simple communication protocol for a UART interface. I use byte packages for data transfer and I found this library very useful in my projects.

https://xod.io/libs/gabbapeople/simple-byte-protocol/

You can try this library in cases when you need to get only exact values from a large data flow through a UART.

To read more follow the quick start guide:

If something doesn’t work please leave a comment. Your feedback is valuable to me.


#2

@gabbapeople

Thanks for the tutorial! Perhaps you can can help me with my problem:
I want to do the same thing like shown in this tutorial but without HEADER, HEAD and CHECKSUM node. Just sending three bytes and receiving three bytes. I tried to modificate the examples in xod/uart but it was not working at all. A modification of this example was also not possible when I left the HEAD-pin blank.
Any help is apreciated. Thanks in advance!


#3

Blank HEAD pin, it still contains some byte.

For your example is better to use three write-byte nodes from xod/uart sequentially.

In fact:

  • the packet node creates a simple byte array. For example (uint8_t array[size]).
  • the add-head node fills the [0] element of the array. (array[0] = head).
  • the add-byte-to-packet fills the [1], [1+i], … [size-1] array elements for i = 0; i < size-1;
  • the add-checksum fills the [size-1] array element.

Thus, sending 3 bytes only by the packet and add-byte-to-packet nodes requires some changes in C++ implementation.

I will return to work on the library as soon as possible and make examples that are similar to yours. Meanwhile, you can try to do it yourself =)


#4

Hello @gabbapeople!

I don’t know why my previous projects did not work. I used two Nanos; one for sending and one for receiving. Now I used three write-byte nodes how you suggested and a Serial-to-USB Converter as receiver. This will work for me and I have immediate control of the result on my terminal software. Next step is the other way round: I will use three receive-byte nodes and send some bytes from the terminal program.