Mallow Verdin imx8mp config i2c as gpio

Hello!
For this config: Mallow board + Verdin iMX8M Plus (2GB).

Can I config the i2c2, i2c3, i2c4 as GPIO and use them as GPIO ?

GPIO5_IO16 ->> I2C2_SCL
GPIO5_IO17 ->> I2C2_SDA
GPIO5_IO18 ->> I2C3_SCL
GPIO5_IO19 ->> I2C3_SDA
GPIO5_IO20 ->> I2C4_SCL
GPIO5_IO21 ->> I2C4_SDA

Thanks!

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


Hello!

Yes, you can configure the I2C2, I2C3, and I2C4 pins on the Verdin iMX8M Plus module as GPIOs when using a Mallow board. This involves modifying the device tree to change the pin multiplexing settings. Here’s how you can do it:

  1. Understand Pin Multiplexing: Each pin on the i.MX8M Plus can serve multiple functions, such as I2C or GPIO. You’ll need to change the pin’s function from I2C to GPIO using device tree overlays.

  2. Check Current Pin Usage: Before making changes, ensure that the pins you want to use as GPIOs are not currently in use by other peripherals. You can verify this by examining the base device tree files.

  3. Create a Device Tree Overlay:

    • Use the TorizonCore Builder Tool to create a new device tree overlay file (.dts).
    • Define a pin control node in the overlay to set the desired pins as GPIOs. For example:
      &iomuxc {
          pinctrl_gpio: gpio_pins {
              fsl,pins = <
                  MX8MP_IOMUXC_GPIO5_IO16_GPIO5_IO16 0x06000021
                  MX8MP_IOMUXC_GPIO5_IO17_GPIO5_IO17 0x06000021
                  MX8MP_IOMUXC_GPIO5_IO18_GPIO5_IO18 0x06000021
                  MX8MP_IOMUXC_GPIO5_IO19_GPIO5_IO19 0x06000021
                  MX8MP_IOMUXC_GPIO5_IO20_GPIO5_IO20 0x06000021
                  MX8MP_IOMUXC_GPIO5_IO21_GPIO5_IO21 0x06000021
              >;
          };
      };
      
    • Ensure the correct hexadecimal values for the pad control register are used.
  4. Apply the Overlay:

    • Build the overlay using the TorizonCore Builder Tool.
    • Deploy the overlay to your module by applying it via SSH.
  5. Verify the Configuration: After applying the overlay, check that the pins are functioning as GPIOs by accessing them through the Linux GPIO interface.

By following these steps, you can successfully configure the specified I2C pins as GPIOs on your Verdin iMX8M Plus module. Make sure to handle any potential pin conflicts by disabling the current functionality of the pins in the device tree if necessary.

Best regards,
Toradex AI Assistant.

Please, also check if these links can help you solve your problem:

Some GPIO not responding to gpiod commands.

Hi, @catalin.roman!

The Toradex AI answer gives good insights, and I can complement a bit:

  • You can use the Pinout Designer Tool to learn which pins can be used as GPIO.
  • Check the datasheets for Mallow and Verdin iMX8M Plus to confirm that those pins are available as GPIO (alternate function table) and in the extension header.

Remember to check if this GPIO usage conflicts with other functions as the I2C buses are commonly used on other interfaces, such as CSI camera connectors. The pinout designer tool can also help you with that.

Best regards,
Danilo Viana