Struggling while pinmuxxing

Hi.
I am trying to use sodimm 19 and 21 as UART instead of it’s reset state GPIO.
https://docs.toradex.com/102075-colibri-imx6-datasheet.pdf
I read the article given here:
https://developer.toradex.com/torizon/os-customization/use-cases/pin-multiplexing-changing-pin-functionalities-in-the-linux-device-tree/

I have a question.
How can I determine BIT_CONFIG value given here “PIN_NAME BIT_CONFIG” for UART.

In article it is said that;

" The bit configuration values were selected according to other GPIO pins set in the device tree. In our case, we will set them to 0x06000021 ."

It make sense when setting it for gpio. But I couldn’t manage to find a BIT_CONFIG value for uart.
I tried to research these bit_config values simply makes some setting for pad control.

While I was exploring I encountered these definitions.
Does this numbers have something to do with bit_config values that I need ?

1052 #define MX6QDL_PAD_SD4_CLK__UART3_RX_DATA           0x338 0x720 0x90c 0x2 0x2
1053 #define MX6QDL_PAD_SD4_CLK__UART3_TX_DATA           0x338 0x720 0x000 0x2 0x0

Hi @oceanblue,

Instead of just point to documentation, I will explain this in my engineering way.

Since you mentioned a couple of defines with UART3 in their names, I assume that you want to reconfigure UART3 port. If you look at UART3 definition in device tree, it looks like this:

/* Colibri UART_C */
&uart3 {
        fsl,dte-mode;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_uart3_dte>;
        status = "disabled";
};

Now, if can find a definition of pinctrl_uart3_dte:

pinctrl_uart3_dte: uart3dtegrp {
        fsl,pins = <
                MX6QDL_PAD_SD4_CLK__UART3_TX_DATA       0x1b0b1
                MX6QDL_PAD_SD4_CMD__UART3_RX_DATA       0x1b0b1
        >;
};

These are in fact physical pins (pads) which are allocated for this UART3 port. You, of course, can use other pads, since CPU’s/MCU’s gives you possibility to use same peripheral via few other pads.

In case of UART3, just search for _UART3_RX_ & _UART3_TX_ in imx6q-pinfunc.h file:

$ grep _UART3_RX_ imx6q-pinfunc.h
#define MX6QDL_PAD_EIM_D24__UART3_RX_DATA           0x0b4 0x3c8 0x930 0x2 0x0
#define MX6QDL_PAD_EIM_D25__UART3_RX_DATA           0x0b8 0x3cc 0x930 0x2 0x1
#define MX6QDL_PAD_SD4_CMD__UART3_RX_DATA           0x2f4 0x6dc 0x930 0x2 0x2
#define MX6QDL_PAD_SD4_CLK__UART3_RX_DATA           0x2f8 0x6e0 0x930 0x2 0x3
$ grep _UART3_TX_ imx6q-pinfunc.h
#define MX6QDL_PAD_EIM_D24__UART3_TX_DATA           0x0b4 0x3c8 0x000 0x2 0x0
#define MX6QDL_PAD_EIM_D25__UART3_TX_DATA           0x0b8 0x3cc 0x000 0x2 0x0
#define MX6QDL_PAD_SD4_CMD__UART3_TX_DATA           0x2f4 0x6dc 0x000 0x2 0x0
#define MX6QDL_PAD_SD4_CLK__UART3_TX_DATA           0x2f8 0x6e0 0x000 0x2 0x0

So if your intention is to use other pads for UART3, it would be as simple as updating pinctrl with relevant names, for example:

pinctrl_uart3_dte: uart3dtegrp {
        fsl,pins = <
                MX6QDL_PAD_EIM_D24__UART3_RX_DATA       0x1b0b1
                MX6QDL_PAD_EIM_D25__UART3_TX_DATA       0x1b0b1
        >;
};

Now, you might ask what are these values on the right side, 0x1b0b1? This is the actual pad control register value, and you can decode it by looking into application processor reference manual. For example, for MX6QDL_PAD_EIM_D24__UART3_RX_DATA the corresponding pad control register is IOMUXC_SW_PAD_CTL_PAD_EIM_DATA24, 36.4.238, page 2016 of RM.

According to that table, 0x1b0b1 means:

  • hysteresis enabled
  • 100K pull-up
  • pull selected
  • pull enabled
  • open drain output disabled
  • medium speed
  • drive strength 40ohm
  • fast slew rate

So, for example, if you don’t need internal pull-ups on these pads, you can disable them by changing this value, 0x1a0b1.

Reference manual can be obtained from NXP website, and I cannot share it here for legal reasons. Document I was looking at is: IMX6DQRM, Rev. 6, 05/2020.

Hope this helps.

Best regards,
Andrejs Cainikovs.

4 Likes

Also the article you were referring to was showing info for an imx8 and not imx6 module

1 Like

Hi.
I am working both colibri and apalis imx8 yes mixed up thanks for correction.