Difference between revisions of "Xenomai RTSerial"

From wiki.emacinc.com
Jump to: navigation, search
Line 33: Line 33:
  
 
==== iMX6 rt_imx_uart ====
 
==== iMX6 rt_imx_uart ====
 +
<syntaxhighlight lang="console">
 +
root@somimx6-xenomai:~# echo 2020000.serial > /sys/bus/platform/drivers/imx-uart/unbind
 +
root@somimx6-xenomai:~# echo 21e8000.serial > /sys/bus/platform/drivers/imx-uart/unbind
 +
root@somimx6-xenomai:~# modprobe xeno_imx_uart
 +
root@somimx6-xenomai:~# dmesg | tail          .
 +
.
 +
[  462.425158] console [ttymxc1] disabled
 +
[  528.025034] rtser0 on IMX UART0: membase=0xc0c10000 irq=58 uartclk=80000000
 +
[  528.025700] rtser1 on IMX UART1: membase=0xc0c18000 irq=59 uartclk=80000000
 +
[  528.026096] rtser2 on IMX UART2: membase=0xc0c20000 irq=60 uartclk=80000000
 +
</syntaxhighlight>
  
 
=== Configuring the serial port ===
 
=== Configuring the serial port ===

Revision as of 19:20, 3 March 2016

TODO: {{#todo: NotStarted (03.03.2016-13:01->MW+)|Michael Welling|OE 5.0,MW,NotStarted}}

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

root@somimx6-xenomai:~# echo 2020000.serial > /sys/bus/platform/drivers/imx-uart/unbind
root@somimx6-xenomai:~# echo 21e8000.serial > /sys/bus/platform/drivers/imx-uart/unbind
root@somimx6-xenomai:~# modprobe xeno_imx_uart
root@somimx6-xenomai:~# dmesg | tail          .
.
[  462.425158] console [ttymxc1] disabled
[  528.025034] rtser0 on IMX UART0: membase=0xc0c10000 irq=58 uartclk=80000000
[  528.025700] rtser1 on IMX UART1: membase=0xc0c18000 irq=59 uartclk=80000000
[  528.026096] rtser2 on IMX UART2: membase=0xc0c20000 irq=60 uartclk=80000000

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-link
main : write-file opened
main : write-config written
main : read-file openedmain : read-config written
main : write-task createdmain : read-task created
main : starting write-task
main : 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
.
.

Conclusion

Further Information

Where to Go Next
Pages with Related Content