How do I configure pins in FreeRTOS, uboot and Linux for an i.MX?

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I configure pins in FreeRTOS, uboot and Linux for an i.MX?

442 Views
paul_quiring
Contributor I

Hello Community,

I want to configure the Pad GPIO1_IO02 to use alternate mode 5. Furthermore, I don't want to use the default settings of the pad as shown in table "Table 4-1. Pin Assignments" of the document IMX6SXRM.pdf.

default settings
HYS - DISABLED
PUS -
PUS_100KOHM_PD
PUE - KEEP
PKE - ENABLED
ODE - DISABLED
SPEED - 100MHZ
DSE - 43_OHM
SRE - SLOV

settings I want to use

HYS - ENABLED
PUS - 47K Ohm Pull Up
PUS_100KOHM_PD
PUE - KEEP
PKE - ENABLED
ODE - DISABLED
SPEED - 150MHz @ 3.3V
DSE - 43_OHM
SRE - SLOV

  • What would the patch for the Yoko build look like (uboot, Linux) in order to get the desired settings for the pad GPIO1_IO02?
  • What must be changed in the case I2C2_BASE of the function "void configure_i2c_pins(I2C_Type* base)" in order to achive the settings I want to use. Below is the piece of code that needs to be changed. It belongs to the FreeRTOS BSP v1.0.1 for the ai development board (FreeRTOS_BSP_1.0.1_iMX6SX\examples\imx6sx_ai_m4\pin_mux.h).
case I2C2_BASE:
// I2C2 iomux configuration
IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO02 = IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO02_MUX_MODE(0) |
IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO02_SION_MASK;
IOMUXC_I2C2_IPP_SCL_IN_SELECT_INPUT = IOMUXC_I2C2_IPP_SCL_IN_SELECT_INPUT_DAISY(1);
IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03 = IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03_MUX_MODE(0) |
IOMUXC_SW_MUX_CTL_PAD_GPIO1_IO03_SION_MASK;
IOMUXC_I2C2_IPP_SDA_IN_SELECT_INPUT = IOMUXC_I2C2_IPP_SDA_IN_SELECT_INPUT_DAISY(1);

IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02 = IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_PKE_MASK |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_PUE_MASK |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_PUS(2) |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_SPEED(2) |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_DSE(6) |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_ODE_SHIFT |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_SRE_MASK |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_HYS_MASK;

IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03 = IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_PKE_MASK |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_PUE_MASK |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_PUS(2) |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_SPEED(2) |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_DSE(6) |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_ODE_SHIFT |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_SRE_MASK |
IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO03_HYS_MASK;
break;

imx6sx‌

freertos‌

uboot

#yocto imx

Labels (3)
2 Replies

190 Views
radhikasomaiya
Senior Contributor II

Hi Paul Quiring,

For FreeRTOS BSP v1.0.1:

You can use the predefined macros to change values of register IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02 according to your required settings.

eg. for PUS

      IOMUXC_SW_PAD_CTL_PAD_GPIO1_IO02_PUS(1)  (to set 47K Ohm Pull Up)

You can refer section 35.5.213 from IMX6SXRM.pdf to change values according to your requirement.

Regards,

Radhika Somaiya.

190 Views
jimmychan
NXP TechSupport
NXP TechSupport

In Yocto BSP, the IOMUX setting is in the device tree file.

For example:

imx6sx-sdb.dtsi

pinctrl_hog: hoggrp {

                          fsl,pins = <

                                   MX6SX_PAD_SD1_DATA0__GPIO6_IO_2 0x17059

                                   MX6SX_PAD_SD1_DATA3__GPIO6_IO_5 0xb000

                                   MX6SX_PAD_CSI_DATA03__GPIO1_IO_17 0x17059

                          >;

                  };

e.g. MX6SX_PAD_SD1_DATA0__GPIO6_IO_2                0x17059

The MUX Mode setting of this is set the PAD "SD1_DATA0" as GPIO6_IO02. All the MUX mode are well defined in the imx6sx-pinfunc.h.

So, for your case, you can use "MX6SX_PAD_GPIO1_IO02__GPIO1_IO_2" in your device tree file.

In this example, the PAD control setting is 0x17059. For the meaning of this, please refer to the Pad Control Register in RM.

pastedImage_8.png