Difference between revisions of "DESK-MX8M-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 19: Line 19:
  
 
=== Device tree configuration ===
 
=== Device tree configuration ===
Here below an example of device tree configuration used on standard DAVE's kit for the ORCA SOM:
+
Here below an example of device tree modifications to standard DAVE's kit for the ORCA SOM:
  
 
From <code>imx8mp-mito8mplus.dtsi</code>:
 
From <code>imx8mp-mito8mplus.dtsi</code>:
  
 
<pre>
 
<pre>
&uart2 {
+
&uart4 {
pinctrl-names = "default";
+
        pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart2>;
+
        pinctrl-0 = <&pinctrl_uart4>;
status = "okay";
+
        assigned-clocks = <&clk IMX8MP_CLK_UART4>;
 +
        assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
 +
        fsl,uart-has-rtscts;
 +
        status = "okay";
 
};
 
};
  
 
&iomuxc {
 
&iomuxc {
pinctrl-names = "default";
 
pinctrl-0 = <&pinctrl_hog>;
 
 
...
 
...
 
...
 
...
pinctrl_uart2: uart2grp {
+
        pinctrl_uart4: uart4grp {
fsl,pins = <
+
                fsl,pins = <
MX8MP_IOMUXC_UART2_RXD__UART2_DCE_RX 0x49
+
                        MX8MP_IOMUXC_ECSPI2_SCLK__UART4_DCE_RX    0x140
MX8MP_IOMUXC_UART2_TXD__UART2_DCE_TX 0x49
+
                        MX8MP_IOMUXC_ECSPI2_MOSI__UART4_DCE_TX    0x140
>;
+
                        MX8MP_IOMUXC_ECSPI2_MISO__UART4_DCE_CTS  0x140
};
+
                        MX8MP_IOMUXC_ECSPI2_SS0__UART4_DCE_RTS    0x140
 +
                >;
 +
        };
 +
 
 
</pre>
 
</pre>
  
Line 49: Line 53:
 
...
 
...
 
...
 
...
[    0.754248] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 26, base_baud = 5000000) is a IMX
+
[    0.755511] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 26, base_baud = 5000000) is a IMX
[    0.761203] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 27, base_baud = 5000000) is a IMX
+
[    0.762356] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 27, base_baud = 5000000) is a IMX
[    0.769995] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 28, base_baud = 1500000) is a IMX
+
[    0.771151] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 28, base_baud = 1500000) is a IMX
 +
[    0.779648] printk: console [ttymxc1] enabled
 +
[    0.798672] 30a60000.serial: ttymxc3 at MMIO 0x30a60000 (irq = 35, base_baud = 5000000) is a IMX
 
...
 
...
 
...
 
...
Line 67: Line 73:
  
 
<pre class="workstation-terminal">
 
<pre class="workstation-terminal">
root@desk-mx8mp:~# stty -F /dev/ttymxc2 115200 -echo
+
root@desk-mx8mp:~# stty -F /dev/ttymxc3 115200 -echo
root@desk-mx8mp:~# cat /dev/ttymxc2 &
+
root@desk-mx8mp:~# cat /dev/ttymxc3 &
 
[2] 555
 
[2] 555
root@desk-mx8mp:~# echo "Test loopback" > /dev/ttymxc2
+
root@desk-mx8mp:~# echo "Test loopback" > /dev/ttymxc3
 
root@desk-mx8mp:~# Test loopback
 
root@desk-mx8mp:~# Test loopback
 
</pre>
 
</pre>

Revision as of 14:15, 30 December 2021

History
Version Issue Date Notes
1.0.0 Jan 2022 First DESK-MX8M release


Peripheral UART[edit | edit source]

Device tree configuration[edit | edit source]

Here below an example of device tree modifications to standard DAVE's kit for the ORCA SOM:

From imx8mp-mito8mplus.dtsi:

&uart4 {
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart4>;
        assigned-clocks = <&clk IMX8MP_CLK_UART4>;
        assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_80M>;
        fsl,uart-has-rtscts;
        status = "okay";
};

&iomuxc {
...
...
        pinctrl_uart4: uart4grp {
                fsl,pins = <
                        MX8MP_IOMUXC_ECSPI2_SCLK__UART4_DCE_RX    0x140
                        MX8MP_IOMUXC_ECSPI2_MOSI__UART4_DCE_TX    0x140
                        MX8MP_IOMUXC_ECSPI2_MISO__UART4_DCE_CTS   0x140
                        MX8MP_IOMUXC_ECSPI2_SS0__UART4_DCE_RTS    0x140
                >;
        };

Accessing the peripheral[edit | edit source]

Linux messages at boot time[edit | edit source]

...
...
[    0.755511] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 26, base_baud = 5000000) is a IMX
[    0.762356] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 27, base_baud = 5000000) is a IMX
[    0.771151] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 28, base_baud = 1500000) is a IMX
[    0.779648] printk: console [ttymxc1] enabled
[    0.798672] 30a60000.serial: ttymxc3 at MMIO 0x30a60000 (irq = 35, base_baud = 5000000) is a IMX
...
...
root@desk-mx8mp:~#

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
...
root@desk-mx8mp:~# stty -F /dev/ttymxc3 115200 -echo
root@desk-mx8mp:~# cat /dev/ttymxc3 &
[2] 555
root@desk-mx8mp:~# echo "Test loopback" > /dev/ttymxc3
root@desk-mx8mp:~# 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