GPIO definitions


I’m creating a firmware for the Cortex-M4 and for every GPIO I need to use, it takes some steps:

  1. Follow the pin in the connector to the SODIMM using the schematic.

  2. Find in the Toradex Tool the name of the PAD associated to that module pin

  3. Find in the Reference Manual which is the name of the registers and which gpio and pin it is associated.
    After that I can define, using the same struct defined in the examples this:

    // 79 ECSPI1_MISO GPIO04_18 5
    gpio_config_t gpioX20_37 = {
    “SODIMM 79”, // name (X20.37 on Aster)
    5, // muxConfig
    IOMUXC_SW_PAD_CTL_PAD_ECSPI1_MISO_PS(2) | // padConfig
    GPIO4, // base
    18 // pin
    It takes a while for every pin.
    So, I was wondering if Toradex already have this or something similar defined somewhere.
    Maybe an include for each module.

Thanks, Mauricio Scaff

Hi @mscaff!

I think you could refer to the pinfunc include. For the iMX7, you would find it inside the Linux kernel sources at arch/arm/boot/dts/imx7d-pinfunc.h.
This is a list of all SoC pads with their possible functions.

Hi, Gustavo.

It helps but not much.
From that file I can only guess what are the real register names (defined in MCIMX7D_M4.h) and more important I still do not have a link between the PAD name and the Module pin.

I still have to use the toradex app just to check which pin form the module goes to which pin from the SOC.

Best regards, Mauricio

hi @mscaff

This is true. For the PAD name of the corresponding Module Pin, you can look in the datasheet or as you are already doing use the gpio_tool.

For your gpio definitions, AFAIK there is no other simple way to do this. In Linux, there is this C Library called libsoc, which can be used to interface with common peripheral of SOC. Something similar does not exist for Cortex-M4.

Best regards,

That is unfortunate.
Something that Toradex, could easy provide using a few hours of a trainee, since it is the only one having access to the module schematics,

Thanks, Mauricio

You don’t need to have module schematic for this task. All information about relations between X1 pins and iMX7 Ball names provided at Table 4.4.1 (page 20) of Colibti iMX7 datasheet -