Question regarding UART (RS485) coding implementation in Linux OpenEmbedded Application (Yocto)

I am developing an Linux OpenEmbedded application (Yocto) with “Apalis iMX8 QuadXPlus 2GB Wi-Fi / Bluetooth IT”.

I need to enable/use UART (RS 485), and I have some questions:

I am planning to use an open source library from GitHub:

Blog: C++ cross-platform RS232 serial communication library |

Code : GitHub - imabot2/serialib: Serial library for Linux & Windows

But I worry it doesn’t work, because I notice that from Toradex document:

Seems need to enable the RS485 flag during C/C++ coding implementation

Question 1: So I am wonder can the open source library still good to be used ? I thought RS232 & RS485 are using same protocol so coding implementation should be the same. If no, please explain in more details.

Question 2: Do you know any open source library ? If yes, please share me the link(s).

Thank you very much !

Greetings @tanchunhau!

The best course of action is to enable RS-485 support on the device tree as described here.

With this enabled, you can use any serial library you want such as the one you linked, since the kernel driver will deal with the RS-485 protocol specifics automatically.

Okay, thank you.

You are welcome.