How to use UART 1 in Colibri IMX8DX WB with viola carrier board?

Hello,

I have the following configuration:
Colibri IMX8DX 1GB WB v1.0D
Viola Plus v1.2B
Torizon Core BSP 5

I’m already using UARTs A, B and C, and now I need to use UART 1 to connect a new sensor.
I created a device tree overlay to enable UART 1 (X1 pins 30, 28, 67, 61) on Viola CB (pins 42, 43, 44, 22 of X9 extension connector).

In my device tree overlay I disable the PWMs that use the same pins as UART 1 and enable the lpuart1, as shown below:

/* Colibri PWM_B */
&pwm0 {
status= “disabled”;
};

/* Colibri PWM_C */
&pwm1 {
status= “disabled”;
};

/* Colibri PWM_D */
&pwm2 {
status= “disabled”;
};

&lpuart1 {
status= “okay”;
};

In the imx8x-colibri.dtsi file, I added the following lines along with the other settings for UARTs A, B and C:
pinctrl_lpuart1: lpuart1grp {
fsl,pins = <
IMX8QXP_UART1_TX_LSIO_PWM0_OUT 0x06000020 // SODIMM 28
IMX8QXP_UART1_RX_LSIO_PWM1_OUT 0x06000020 // SODIMM 30
IMX8QXP_UART1_RTS_B_LSIO_PWM2_OUT 0x06000020 // SODIMM 67
IMX8QXP_UART1_CTS_B_ADMA_LCDIF_D17 0x06000020 // SODIMM 61
>;
};

&lpuart1 {
pinctrl-names = “default”;
pinctrl-0 = <&pinctrl_lpuart1>;
};

I’m using TorizonCore Builder to build and to update the device tree overlay using the command torizoncore-builder dto deploy …

But when I do a loopback test on pins 42 and 43 of Viola Carrier’s X9, using picocom terminal and I don’t get any data in the serial.

Can anybody help me?
Thank you in advance.

Greetings @jullierme_lpx,

Looking at the information you provided, I noticed one issue immediately. In the new node pinctrl_lpuart1 that you defined, you have the pinmux definitions incorrect. For NXP i.MX devices the pin macro definitions follow a specific format. The macro is composed of 3 parts, for example let’s look at IMX8QXP_UART1_TX_LSIO_PWM0_OUT.

  • The first part is the SoC indentifier, in our example we see this is IMX8QXP. You don’t never to change this.
  • The second part is the ball name which in this case is UART1_TX. This refers to a specific pin.
  • The third and final part is the alternate function which here is LSIO_PWM0_OUT. This decides what function this pin is configured for.

With that said, notice how in your pinctrl group you didn’t change any of the alternate functions for UART operation. For a list of all pin macros definitions you can see the defining file here: pads-imx8qxp.h « pinctrl « dt-bindings « include - linux-toradex.git - Linux kernel for Apalis, Colibri and Verdin modules

So for the case of IMX8QXP_UART1_TX_LSIO_PWM0_OUT, what you actually want is, IMX8QXP_UART1_TX_ADMA_UART1_TX .

You’ll need to adjust the other pins in that node accordingly for UART function. Try this change and see if it helps. I’m not sure if this is the only issue but it’s the one I noticed first.

Best Regards,
Jeremias

Hello, @jeremias.tx.
Thanks for the clear explanation.

I change to the correct macros and added it to my device tree overlay code, as I am only building the overlay using the command torizoncore-builder dto … . and… it worked!
For those who need to add new uarts like me, follow the code of my device tree overlay to add UART1:

/dts-v1/;
/plugin/;
#include <dt-bindings/pinctrl/pads-imx8qxp.h>
/ {
	compatible = "toradex,colibri-imx8x-eval-v3";
};

/* Colibri PWM_B */
&pwm0 {
	status= "disabled";
};

/* Colibri PWM_C */
&pwm1 {
	status= "disabled";
};

/* Colibri PWM_D */
&pwm2 {
	status= "disabled";
};

&iomuxc {
	colibri-imx8qxp {
		pinctrl_lpuart1: lpuart1grp {
			fsl,pins = <
				IMX8QXP_UART1_TX_ADMA_UART1_TX			0x06000020	// SODIMM  28 
				IMX8QXP_UART1_RX_ADMA_UART1_RX			0x06000020	// SODIMM  30 
				IMX8QXP_UART1_RTS_B_ADMA_UART1_RTS_B			0x06000020	// SODIMM  67 
				IMX8QXP_UART1_CTS_B_ADMA_UART1_CTS_B			0x06000020	// SODIMM  61
			>;
		};
	};
};

&lpuart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_lpuart1>;
	status= "okay";
};

Perfect, glad to hear that was the only thing to be fixed. Glad I could help out!