AnsweredAssumed Answered

Pin Config vs Pin Mux

Question asked by Lars Heinrichs on Feb 5, 2018
Latest reply on Feb 5, 2018 by igorpadykov

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?

Outcomes