Xenomai RTSerial
Contents
General Information
Xenomai provides a RTDM profile for serial device drivers enabling real-time UART serial communication. The RTDM serial driver provides the necessary user-space API to perform serial port configuration and communication. The following sections will outline the use of the user-space interface and provide basic examples.
Xenomai RTSerial
Given the RTDM serial port driver exist and is loaded for the target on hand, it will provide a device nodes at /dev/rtdm/rtserX where X is replaced by the number of the port. This device node is then accessed to configured and communicate using the underlying port. The following sections with outline loading the driver, configuring the port, and performing basic serial transactions.
Loading the driver
Typically there will be a Linux kernel driver associated with the port. If desired device is associated with a Linux driver the driver must be unloaded or the device must be unbound from the driver. Below are examples of loading the RTDM driver for some supported targets.
x86 16550A
iMX6 rt_imx_uart
Configuring the serial port
Performing serial transactions
Examples
Xenomai provides an example called cross-link which provides an easy way to test serial ports. Essentially the demo send data from one serial port and receives it on another. To run the demo make sure the RTDM driver is load and connect the first two port via a NULL modem cable.
root@somimx6-xenomai:~# /usr/demo/cross-linkmain : write-file openedmain : write-config writtenmain : read-file openedmain : read-config writtenmain : write-task createdmain : read-task createdmain : starting write-taskmain : starting read-task Nr | write->irq | irq->read | write->read |----------------------------------------------------------- 0 |18446744041591572624 | 32118717325 | 738333 1 |18446744041591563290 | 32118715326 | 727000 2 |18446744041591563957 | 32118716326 | 728667 3 |18446744041591561291 | 32118714658 | 724333 4 |18446744041591562624 | 32118715992 | 727000 5 |18446744041591560290 | 32118715326 | 724000