Using uart4 on imx7d

I want to use uart4 and therefore i need to change the device tree accordingly. Based on the Colibri documentation i decided to use the SODIMM 200 pin 23 (SD2_DATA0) for uart4.RX and pin 27 (SAI2_TXC) for uart4.TX. This results in a configuration like shown below. However when i try to compile the kernel i am getting errors because of MX7D_PAD_SD2_DATA0__UART4_DTE_RX which seems to be undefined. A closer look into imx7d-pinfunc.h confirms that the pad SD2_DATA0 can only be configured as UART4_DTE_TX or UART4_DCE_RX and not UART4_DTE_RX (because the uarts are used in DTE mode). Only pad SD2_DATA1 can be configured as UART4_DTE_RX… Maybe there is an error in your documentation? How can i use uart4 on these pins (our custom carrier boards is already manufatured)? Regards

&uart4 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart4>;
	assigned-clocks = <&clks IMX7D_UART4_ROOT_SRC>;
	assigned-clock-parents = <&clks IMX7D_OSC_24M_CLK>;

pinctrl_uart4: uart4-grp {
    		fsl,pins = <
    			MX7D_PAD_SD2_DATA0__UART4_DTE_RX 0x79

Greetings @qojote,

I believe the issue is because you are using the UART in DTE mode, the pin functionality gets reversed which can be confusing.

As you can see in this similar posting:

Even though in the data sheet I2C2_SCL is listed as uart4.RX because of the DTE mode the correct muxing option is TX.

Also another issue I see is that SODIMM pin 27 is actually MX7D_PAD_SAI2_TX_BCLK and not MX7D_PAD_SAI2_TX_SYNC.

So I believe this would be the correct pin-muxing:

 pinctrl_uart4: uart4-grp {
             fsl,pins = <
                 MX7D_PAD_SD2_DATA0__UART4_DTE_TX 0x79
                 MX7D_PAD_SAI2_TX_BLCK__UART4_DTE_RX 0x79

Best Regards,

You are right, SODIMM pin 27 is SAI2_TX_BCLK. It’s working with your suggested pin-muxing. Thanks a lot!

Hi…programming interface of the UART driver is given in platform/drivers/inc/uart_imx.h.
To initialize the UART module, define an uart_init_config_t type variable and pass it to the UART_Init()
function. Here is the Members of the structure definition:

  1. clockRate: Current UART module clock frequency. This variable can be obtained by calling get_-
    uart_clock_freq() function;

pcb manufacturing and assembly

I am using Colibri iMX7d 1G eMMC board V3.2B

I want to use UART4, 5, 6, and 7.
Can you please suggest me which pins I should use and what to disable if those pins are shared?

Tried couple of pins as per my understanding and google data but didn’t work.
Any help will be appreciated.

Hi @neeraj.verma,

Please observe the i.MX7 datasheet( The UART section lists what pins are used for which UART interface. While the functions list shows what each pin is assigned as by default. You’ll need to reassign the pins in the device tree, while unassign any pin that is used by a conflicting resource by default.

Thank you for the link, although I already had it.
as per mapping if I add below, I don’t see driver up under /devlink text
pinctrl_uart4: uart4-grp {
fsl,pins = <

Please have a look at attached mapping and suggest me.

For your pinmuxing in uart4-grp, why are you using pins meant for UART5 instead of the UART4 pins?

When I add : (see attached diff)
pinctrl_uart4: uart4-grp {
fsl,pins = <
I do not see UART4 driver up under /dev
link text

By default the specific UART 4 pins reference in this post are muxed to other functions in the device tree. You need to either remove/disable these pins as they are used in their default functions so you can then reassign them to be used as UART4 pins. Do keep in mind what interfaces would be affected by doing this.

Your other option would be to use other pins. The i.MX7 datasheet lists all pins that can be used for UART4 so the pins listed in this post aren’t your only option. You need to examine what pins you can use based on your needs, just take care as these pins may already be in use by other interfaces.

I tried disabling (status = “disabled”) one by one and disabled almost all the other modules except uart even though I do not see uart4 under /dev.
it means there is some other problem.

Could you share your final device tree files and the dmesg log in a file? Thanks.

@jaski.tx Thanks for asking.

Please find dmesg & dev tree files as text

Thanks for the files. According to your dmesg log, the pin SD2_DATA0 is already used somewhere else.
For using this, in uart4, you need to delete it form other nodes.

[ 1.013174] imx7d-pinctrl 30330000.iomuxc: pin MX7D_PAD_SD2_DATA0 already requested by 30860000.serial; cannot claim for 30a60000.serial
[ 1.029417] imx7d-pinctrl 30330000.iomuxc: pin-112 (30a60000.serial) status -22
[ 1.040718] imx7d-pinctrl 30330000.iomuxc: could not request pin 112 (MX7D_PAD_SD2_DATA0) from group uart4-grp on device 30330000.iomuxc
[ 1.057334] imx-uart 30a60000.serial: Error applying setting, reverse things back
[ 1.069134] imx-uart: probe of 30a60000.serial failed with error -22

Best regards,

OK, Thanks.
Commented out

it’s working now. Thank you so much.

Perfect that it works. Thanks for the feedback.