Skip to main content

Pinmuxing Guide

Introduction

Pin configuration is crucial when working with a custom hardware, external peripherals and/or custom carrier board designs. Furthermore almost all peripherals need signals multiplexed to external pins in order to operate. By specifying the pin function and settings, you gain control over the physical pins. Using Linux, this is done by customizing Device trees.

To learn which interfaces, pin configurations, and settings can be used on your SoM, you can refer to the Product Datasheet and to our Pinout Designer Tool.

This article introduce a series of guides on setting up pinmux for Toradex SoMs, offering both general and specific information.

Pinmuxing Overview on Toradex SoMs

The majority of i.MX SoC pins are multiplexed and offer a range of alternate pin functions, along with configurable settings like internal pull-ups and pull-downs. This overview will walk you through the process of configuring pin functions and settings for devices within the Linux device tree. However, assigning pins to a driver works with standardized bindings. Each pinctrl subnode needs to be assigned to a driver, otherwise, the pinctrl won't apply the settings on its own. How and how many pinctrl groups can be assigned to a device depends on the device driver used. Most drivers are documented in the kernel source under Documentation/devicetree/bindings/. The default assignment can be made using pinctrl-n or pinctrl-names properties.

Setting up the Pinmux for a device

To configure physical pin control (e.g., I2C, PWM, UART) in a device node, follow these steps:

  1. Add a pin group node to define pin function and settings in the IOMUXC node's related *.dtsi file.

    &iomuxc {
    ...
    pinctrl_i2c3: i2c3grp {
    fsl,pins = <
    MX6QDL_PAD_GPIO_3__I2C3_SCL 0x4001b8b1
    MX6QDL_PAD_GPIO_6__I2C3_SDA 0x4001b8b1
    >;
    };
    ...
    };
  2. Reference the created pin group node in the new device's node.

        &i2c3 {
    clock-frequency = <100000>;
    pinctrl-names = "default", "gpio";
    pinctrl-0 = <&pinctrl_i2c3>;
    ...
    };
  3. Verify that the pinctrl has been picked up by the driver and correctly applied:

    # cat /sys/kernel/debug/pinctrl/pinctrl-handles

Pin Configuration Files

The device tree bindings directory contains a pin configuration file for each System-on-Chip (SoC), which includes pin function macro definitions and relevant documentation. For a deeper understanding of the pin function macro values, refer to documentation specific to the SoC in question. The pin header files can be found in the paths specified on the table, while the corresponding documentation is located in Documentation/devicetree/bindings/arm/freescale/.

Related Toradex SoMHeader FilePin Control Documentation
Colibri iMX6arch/arm/boot/dts/imx6dl-pinfunc.hfsl,imx6dl-pinctrl.txt
Apalis iMX6arch/arm/boot/dts/imx6q-pinfunc.hfsl,imx6q-pinctrl.txt
Colibri iMX6ULLarch/arm/boot/dts/imx6ull-pinfunc.h
arch/arm/boot/dts/imx6ull-pinfunc-lpsr.h
arch/arm/boot/dts/imx6ul-pinfunc.h
fsl,imx6ul-pinctrl.txt
Colibri iMX7arch/arm/boot/dts/imx7d-pinfunc.h
arch/arm/boot/dts/imx7d-pinfunc-lpsr.h
fsl,imx7d-pinctrl.txt
Apalis iMX8include/dt-bindings/pinctrl/pads-imx8qm.hfsl,scu.txt
Colibri iMX8Xinclude/dt-bindings/pinctrl/pads-imx8qxp.h
include/dt-bindings/pinctrl/pads-imx8dxl.h
fsl,scu.txt
Verdin iMX8M Miniarch/arm64/boot/dts/freescale/imx8mm-pinfunc.hfsl,imx8mm-pinctrl.txt
Verdin iMX8M Plusarch/arm64/boot/dts/freescale/imx8mp-pinfunc.hfsl,imx8mp-pinctrl.txt

Next Steps

Toradex offers a set of articles with specific content about how to leverage pinmuxing on the Toradex System on Modules:



Send Feedback!