UART5 with IMX7D

I am trying to enable UART 5 on the Colibri Evaluation Board v3.2 working with iMX7D (1gb). I’ve already modified the device tree applying these changes:

diff --git a/arch/arm/boot/dts/imx7-colibri.dtsi b/arch/arm/boot/dts/imx7-colibri.dtsi
index 348d98e110fc3..3b218e92ef76f 100644
--- a/arch/arm/boot/dts/imx7-colibri.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri.dtsi
@@ -668,7 +667,6 @@
 	pinctrl-0 = <&pinctrl_uart2>;
 	assigned-clocks = <&clks IMX7D_UART2_ROOT_SRC>;
 	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
-	uart-has-rtscts;
 	fsl,dte-mode;
 };
 
@@ -680,6 +678,14 @@
 	fsl,dte-mode;
 };
 
+&uart5 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_uart5>;
+	assigned-clocks = <&clks IMX7D_UART5_ROOT_SRC>;
+	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;
+	fsl,dte-mode;
+};
+
 &usbotg1 {
 	dr_mode = "otg";
 };
@@ -1035,6 +1030,13 @@
 		>;
 	};
 
+	pinctrl_uart5: uart5-grp {
+		fsl,pins = <
+			MX7D_PAD_I2C2_SCL__GPIO4_IO10 0x79
+			MX7D_PAD_I2C2_SDA__GPIO4_IO11 0x79
+		>;
+	};
+
 	pinctrl_usbc_det: gpio-usbc-det {
 		fsl,pins = <
 			MX7D_PAD_ENET1_CRS__GPIO7_IO14	0x14
diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index 2796810426285..8555833782295 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -150,6 +150,10 @@
 	status = "okay";
 };
 
+&uart5 {
+	status = "okay";
+};
+
 &usbotg1 {
 	extcon = <&extcon_usbc_det>, <&extcon_usbc_det>;
 	vbus-supply = <&reg_usbh_vbus>;

After compiling and installing the image, with the applied changes, then I open the JP17 and JP19 to wire the SODIMM pins 88 and 86 to TXD and RXD respectively.

However if I connect a USB to serial cable to the bottom UART connector (X25) with my PC I can’t see any messages sent or received (I am using screen with /dev/ttymx4 configured with baudrate 115200).

Kernel Version: Linux colibri-imx7-emmc 5.4.115-5.3.0-devel+git.dbdbcabf0f98 #1 SMP Tue Jul 6 08:47:10 UTC 2021 armv7l armv7l armv7l GNU/Linux

Let me know if you need any further information.

Best regards,

Hello @gojeda!

Welcome to the Toradex community.

First, do you want to use the SODIMM pins 86 and 88? These pins in the datasheet have the function for UART4 and not UART5.

About your patch, you inserted the correct pins into the pinctrl node, but you have to change the function, all functions are displayed in the imx7d-pinfunc.h file, you need to do something like this:

+	pinctrl_uart4: uart4-grp {
+		fsl,pins = <
+			MX7D_PAD_I2C2_SCL__UART4_DTE_TX 0x79
+			MX7D_PAD_I2C2_SDA__UART4_DTE_RX 0x79
+		>;
+	};

Note that I already changed the name to UART4 because of the pins you are using.

After configuring the new pins functions, you also need to remove the older function, in your case these pins are configured in the pinctrl_ecspi3_cs and pinctrl_ecspi3 nodes, you can find it by searching for the names of the pins MX7D_PAD_I2C2_SDA and MX7D_PAD_I2C2_SCL, and both are inserted by the ecspi3, so you should set the status to disabled as below to prevent iomux issues:

@@ -99,7 +99,7 @@
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
        cs-gpios = <&gpio4 11 GPIO_ACTIVE_HIGH>;
-       status = "okay";
+       status = "disabled";

Can you please try it and check if it works?

Best regards,
Daniel Morais

Hi Daniel,

Thanks for your suggestions. After applying the changes I was able to make it work.

Best regards,
Gustavo