Pin Config vs Pin Mux

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

Pin Config vs Pin Mux

2,141 Views
demoniacmilk
Contributor IV

Hello community,

the RTOS BSP comes with a lot of example code. Even examples without freeRTOS are included.

This is really helpful, thumbs up!

Most examples call a "hardware_init()" function that is usually located in an additional hardware_init.c file.
This function sets up clocks and peripherals. I have a question on the peripheral pin mux setup:

From an I2C example in the BSP:

void configure_i2c_pins(I2C_Type* base){
   switch((uint32_t)base)
   {
      case I2C1_BASE:
      // I2C1 iomux configuration
      IOMUXC_SW_MUX_CTL_PAD_I2C2_SCL =
         IOMUXC_SW_MUX_CTL_PAD_I2C2_SCL_MUX_MODE(0) |
         IOMUXC_SW_MUX_CTL_PAD_I2C2_SCL_SION_MASK;

      IOMUXC_SW_MUX_CTL_PAD_I2C2_SDA =
         IOMUXC_SW_MUX_CTL_PAD_I2C2_SDA_MUX_MODE(0) |
         IOMUXC_SW_MUX_CTL_PAD_I2C2_SDA_SION_MASK;

   

      IOMUXC_I2C2_SCL_SELECT_INPUT = IOMUXC_I2C2_SCL_SELECT_INPUT_DAISY(1);
      IOMUXC_I2C2_SDA_SELECT_INPUT = IOMUXC_I2C2_SDA_SELECT_INPUT_DAISY(1);

   

      IOMUXC_SW_PAD_CTL_PAD_I2C2_SCL = IOMUXC_SW_PAD_CTL_PAD_I2C2_SCL_PE_MASK |
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SCL_PS(3) |
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SCL_DSE(0) |
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SCL_HYS_MASK;

   

     IOMUXC_SW_PAD_CTL_PAD_I2C2_SDA =
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SDA_PE_MASK |
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SDA_PS(3) |
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SDA_DSE(0) |
         IOMUXC_SW_PAD_CTL_PAD_I2C2_SDA_HYS_MASK;
   break;

[...]

The Pins tool output looks very different from the example above:

/* Input Select (DAISY) Field: Selecting Pad: UART2_RX_DATA Mode: ALT1 for I2C2_SCL */
HW_IOMUXC_I2C2_SCL_SELECT_INPUT_WR(

   IOMUXC_BASE,
   BF_IOMUXC_I2C2_SCL_SELECT_INPUT_DAISY(

      BV_IOMUXC_I2C2_SCL_SELECT_INPUT_DAISY_UART2_RX_DATA_ALT1)); 

/* Input Select (DAISY) Field: Selecting Pad: UART2_TX_DATA Mode: ALT1 for I2C2_SDA */
HW_IOMUXC_I2C2_SDA_SELECT_INPUT_WR(
   IOMUXC_BASE,
   BF_IOMUXC_I2C2_SDA_SELECT_INPUT_DAISY(
      BV_IOMUXC_I2C2_SDA_SELECT_INPUT_DAISY_UART2_TX_DATA_ALT1));

So it seems like the file generated by Pins is only setting up the SELECT_INPUT parts.

What happens with the additional settings (containing ...PAD_CTL_PAD...)?

May I simply replace 

      IOMUXC_I2C2_SCL_SELECT_INPUT = IOMUXC_I2C2_SCL_SELECT_INPUT_DAISY(1);

with

      IOMUXC_I2C2_SCL_SELECT_INPUT = IOMUXC_I2C2_SCL_SELECT_INPUT_DAISY(0);

in the example to adjust the pin mux to UART2 pins?

Labels (1)
0 Kudos
1 Reply

849 Views
igorpadykov
NXP Employee
NXP Employee

Hi Lars

daisy functionality is described in 8.2.3.3 Daisy chain - multi pads driving same

module input pin i.MX7D Reference Manual

http://cache.nxp.com/files/32bit/doc/ref_manual/IMX7DRM.pdf
and used for some modules like uart. It is not used for i2c so seems its settings

can be changed.

**PAD_CTL_PAD iomux settings greatly depends on customer layout and usage,

so these settings should be adjusted by customer himself. As starting point one

can use default settings.

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos