i.MX6Q UART and IOMux tool problem?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX6Q UART and IOMux tool problem?

2,463 Views
andrewtrotman
Contributor II

Hi,

When I use the IOMux tool (Version 3.4.0.0) to generate the code to route the pins for UART2 on the i.MX6Q (pins E25/E26) it generates the following code:

void uart2_iomux_config(void)
{
    // Config uart2.UART2_RX_DATA to pad EIM_DATA27(E25)
    HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA27_WR(0x00000004); // DISABLED, ALT4
    // ENABLED, 100K_OHM_PU, PULL, ENABLED, DISABLED, 100MHZ, 40_OHM, SLOW
    HW_IOMUXC_SW_PAD_CTL_PAD_EIM_DATA27_WR(0x0001B0B0);
    HW_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_WR(0x00000000); // EIM_DATA26_ALT4

    // Config uart2.UART2_TX_DATA to pad EIM_DATA26(E24)
    HW_IOMUXC_SW_MUX_CTL_PAD_EIM_DATA26_WR(0x00000004); // DISABLED, ALT4
    // ENABLED, 100K_OHM_PU, PULL, ENABLED, DISABLED, 100MHZ, 40_OHM, SLOW
    HW_IOMUXC_SW_PAD_CTL_PAD_EIM_DATA26_WR(0x0001B0B0);
    HW_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_WR(0x00000000); // EIM_DATA26_ALT4
}

This works fine for writing to the port, but unless I add the following line:

HW_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_WR(BF_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_DAISY_V(EIM_DATA27_ALT4));

I can't read from the port - I don't get a signal on the RDR bit of USR2.  Adding the line fixes the problem - I can read and write to UART2.

Have I missed something here?  I've not tried it on the other UART - presumably I'll find similar problems?

Labels (2)
Tags (1)
9 Replies

1,082 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello,Andrew,

      EIM_D25 can be iomuxed UART3_RX_DATA, not UART2_RX. But UART2_RX can be routed throuth EIM_D27 Pin. Please Check it in I.MX6QRM.pdf , PAGE 275.

Regards,

Weidong

0 Kudos

1,082 Views
YixingKong
Senior Contributor IV

Weidong, since the DI's link has been messed, and we are unable to correct the error, could you finish the DI with the customer ASAP?

Thanks,

Yixing

0 Kudos

1,082 Views
YixingKong
Senior Contributor IV

Weidong, could you reply the customer's further issues?

Thanks,

Yixing

0 Kudos

1,082 Views
andrewtrotman
Contributor II

I'm not sure how that helps.  I'm trying to get UART1 and UART2 to work, I'm not using UART3.  To get UART1 to work I need to add the line:

HW_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_WR(BF_IOMUXC_UART1_UART_RX_DATA_SELECT_INPUT_DAISY_V(SD3_DATA6_ALT1));

This appears to be because the code that the IOMux tool produces incorrectly routes.  For example, IOMux tool produces the code:

HW_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_WR(BF_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_DAISY_V(EIM_DATA26_ALT4));

which routes UART2_TX_DATA. The code should read:

HW_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_WR(BF_IOMUXC_UART2_UART_RX_DATA_SELECT_INPUT_DAISY_V(EIM_DATA27_ALT4));

which routes UART2_RX_DATA.

0 Kudos

1,082 Views
YixingKong
Senior Contributor IV

Andrew, please click Correct Answer/Helpful Answer if your questions had been answered.

Thanks,

Yixing

0 Kudos

1,082 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello,Andrew,

      Actually, UART IOMUX configuration is not idifficult , iomux tool is a way to get it , but we have another easy way to do it : open linux/arch/arm/plat-mxc/include/mach/iomux-mx6q.h, we can find all iomux definitions for pins of i.mx6Q . what we need to do is add definitions to board initialization. for example, let us do IOMUX for UART2.

(1) No.1 method:

----------------------------

MX6Q_PAD_EIM_D26__UART2_TXD      (means EIM_D26--->UART2_TX signal)

MX6Q_PAD_EIM_D27__UART2_RXD     (means EIM_D27--->UART2_RX signal)

-----------------------------

(2)No.2 method:

-------------------------------

MX6Q_PAD_GPIO_7__UART2_TXD           (means GPIO_7--->UART2_TX signal)

MX6Q_PAD_GPIO_8__UART2_RXD            (means GPIO_8--->UART2_RX signal)

--------------------------------

(3)No.3 method

----------------------------

MX6Q_PAD_SD4_DAT4__UART2_TXD      (means SD4_DAT4--->UART2_TX signal)

MX6Q_PAD_SD4_DAT7__UART2_RXD     (means SD4_DAT7--->UART2_RX signal)

----------------------------

Use any one of the above 3 groups , you can get UART2 signals. Then add them to BSP file of your board.

such as mx6q_sabresd board : open linux/arch/arm/mach-mx6/board-mx6q_sabresd.h

static iomux_v3_cfg_t mx6q_sabresd_pads[] = {

......

MX6Q_PAD_EIM_D26__UART2_TXD,

MX6Q_PAD_EIM_D27__UART2_RXD,

.......

}

Regards,

Weidong

1,082 Views
normancheung
Contributor III

Weidong,

Could you please elaborate on why there are 3 methods.  I am facing issue with not able to write to /dev/ttymxc2, I can read.  I wonder if my PAD is set correctly.  Do these 3 methods represent 3 wiring schemes?

Thanks,

Norm

0 Kudos

1,082 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi, Norman,

    Actually, there serveral methords to iomux UART2 signals, could you understand this list ?

I.MX6Q-UART2.png

UART2_RX and UART2_TX can be routed out via 4 different PADs. I just gave you 3 PADs of them before.

Weidong

1,082 Views
normancheung
Contributor III

Got it, I will check with my h/ware guy to see which pin he routed the TX and the RX.

Thanks

0 Kudos