Difference between revisions of "DESK-MX6UL-L/Peripherals/UART"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "<section begin=History/> {| style="border-collapse:collapse; " !colspan="4" style="width:100%; text-align:left"; border-bottom:solid 2px #ededed"|History |- !style="border-le...")
 
Line 21: Line 21:
 
Here below an example of device tree configuration used on standard DAVE's kit for the [[AXEL ULite SOM]]:
 
Here below an example of device tree configuration used on standard DAVE's kit for the [[AXEL ULite SOM]]:
  
From the Carrier <code>imx6ul-lynx-som0013-cb002f.dts</code> device tree:
+
From the Carrier <code>imx6ul-axelulite-cb003a.dts</code> device tree:
  
 
<pre>
 
<pre>
&uart2 {
+
&uart3 {
 
         pinctrl-names = "default";
 
         pinctrl-names = "default";
         pinctrl-0 = <&pinctrl_uart2_flow>;
+
         pinctrl-0 = <&pinctrl_uart3>;
        fsl,uart-has-rtscts;
 
 
         status = "okay";
 
         status = "okay";
 
};
 
};
</pre>
+
...
 
+
...
From <code>imx6qdl-axelcommon.dtsi</code>:
 
 
 
<pre>
 
 
&iomuxc {
 
&iomuxc {
 
         pinctrl-names = "default";
 
         pinctrl-names = "default";
 
         pinctrl-0 = <&pinctrl_hog_gpios>;
 
         pinctrl-0 = <&pinctrl_hog_gpios>;
  
         imx6ul-lynx {
+
         imx6ul-axelulite {
 
...
 
...
 
...
 
...
            pinctrl_uart2_flow: uart2grp-flow {
+
        uart {
                fsl,pins = <
+
                pinctrl_uart3: uart3grp {
                        MX6UL_PAD_UART2_TX_DATA__UART2_DCE_TX 0x1b0b1
+
                        fsl,pins = <
                        MX6UL_PAD_UART2_RX_DATA__UART2_DCE_RX 0x1b0b1
+
                                MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX  0x1b0b1
                         MX6UL_PAD_UART2_CTS_B__UART2_DCE_CTS  0x1b0b1
+
                                MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX  0x1b0b1
                        MX6UL_PAD_UART2_RTS_B__UART2_DCE_RTS  0x1b0b1
+
                         >;
                 >;
+
                 };
 
         };
 
         };
 
...
 
...
Line 60: Line 56:
 
...
 
...
 
...
 
...
[    0.424294] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 21, base_baud = 5000000) is a IMX
+
[    0.437613] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 21, base_baud = 5000000) is a IMX
[    1.125015] console [ttymxc0] enabled
+
[    1.167221] console [ttymxc0] enabled
[    1.130189] 2024000.serial: ttymxc7 at MMIO 0x2024000 (irq = 22, base_baud = 5000000) is a IMX
+
[    1.172839] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 58, base_baud = 5000000) is a IMX
[    1.140851] 21e8000.serial: ttymxc1 at MMIO 0x21e8000 (irq = 58, base_baud = 5000000) is a IMX
 
[    1.150972] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 59, base_baud = 5000000) is a IMX
 
 
...
 
...
 
...
 
...
Line 82: Line 76:
 
  UART8 <-> ttymxc7
 
  UART8 <-> ttymxc7
 
  ...
 
  ...
 +
 +
 +
For exmaple, using a loopback HW connection (RX shortcircuited to TX on UART232 port) it is possibile to test the send and receive data using the <code>ttymxc2</code> device:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@desk-mx6ul-axelulite:~# stty -F /dev/ttymxc7 115200 -echo
+
root@desk-mx6ul-axelulite:~# stty -F /dev/ttymxc2 115200 -echo
root@desk-mx6ul-axelulite:~# cat /dev/ttymxc7 &
+
root@desk-mx6ul-axelulite:~# cat /dev/ttymxc2 &
 
[1] 331
 
[1] 331
root@desk-mx6ul-axelulite:~# echo "Test loopback" > /dev/ttymxc7
+
root@desk-mx6ul-axelulite:~# echo "Test loopback" > /dev/ttymxc2
root@desk-mx6ul-axelulite:~#
+
root@desk-mx6ul-lynx:~# Test loopback
 +
 
 
</pre>
 
</pre>
  

Revision as of 10:31, 16 July 2021

History
Version Issue Date Notes
1.0.0 Apr 2021 First DESK release


Peripheral UART[edit | edit source]

Device tree configuration[edit | edit source]

Here below an example of device tree configuration used on standard DAVE's kit for the AXEL ULite SOM:

From the Carrier imx6ul-axelulite-cb003a.dts device tree:

&uart3 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart3>;
        status = "okay";
};
...
...
&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_hog_gpios>;

        imx6ul-axelulite {
...
...
        uart {
                pinctrl_uart3: uart3grp {
                        fsl,pins = <
                                MX6UL_PAD_UART3_RX_DATA__UART3_DCE_RX   0x1b0b1
                                MX6UL_PAD_UART3_TX_DATA__UART3_DCE_TX   0x1b0b1
                        >;
                };
        };
...
...

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

...
...
[    0.437613] 2020000.serial: ttymxc0 at MMIO 0x2020000 (irq = 21, base_baud = 5000000) is a IMX
[    1.167221] console [ttymxc0] enabled
[    1.172839] 21ec000.serial: ttymxc2 at MMIO 0x21ec000 (irq = 58, base_baud = 5000000) is a IMX
...
...
root@imx6qxelk:~#

Usage with stty[edit | edit source]

N.B. UART mapping respect to ttymxcX is the following one:

UART1 <-> ttymxc0
UART2 <-> ttymxc1
UART3 <-> ttymxc2
UART4 <-> ttymxc3
UART5 <-> ttymxc4
UART6 <-> ttymxc5
UART7 <-> ttymxc6
UART8 <-> ttymxc7
...


For exmaple, using a loopback HW connection (RX shortcircuited to TX on UART232 port) it is possibile to test the send and receive data using the ttymxc2 device:

root@desk-mx6ul-axelulite:~# stty -F /dev/ttymxc2 115200 -echo
root@desk-mx6ul-axelulite:~# cat /dev/ttymxc2 &
[1] 331
root@desk-mx6ul-axelulite:~# echo "Test loopback" > /dev/ttymxc2
root@desk-mx6ul-lynx:~# Test loopback

Additional information[edit | edit source]

Serial ports can be used through the standard serial programming API.

For detailed information, please refer to the Serial Programming HOWTO at Serial-Programming-HOWTO