Help about M4 GPIO

Discussion in 'UDOO NEO' started by PaulR, Dec 29, 2017.

Tags:
  1. PaulR

    PaulR New Member

    Joined:
    Dec 12, 2017
    Messages:
    9
    Likes Received:
    0
    I have been using the example in

    https://github.com/kamejoko80/my_osek/tree/master/NEO_M4_BARE_METAL

    to set a led on/off. It works, but now i'd like to use a led not in board, but connected as GPIO output in one of the external pins. I see in gpio_pins.c, the board LED is set with this:

    gpio_config_t gpioLed = {
    "DEBUG_LED", //name
    &IOMUXC_SW_MUX_CTL_PAD_NAND_DATA02, // muxReg
    5, // GPIO2_IO02 ?
    &IOMUXC_SW_PAD_CTL_PAD_NAND_DATA02, // padReg
    IOMUXC_SW_PAD_CTL_PAD_NAND_DATA02_DSE(6)| // padConfig
    IOMUXC_SW_PAD_CTL_PAD_NAND_DATA02_SPEED(2)|
    IOMUXC_SW_PAD_CTL_PAD_NAND_DATA02_PKE_MASK,
    GPIO4, // base
    6 // pin
    };


    so I will have to select a new pad name associated with the GPIO I choose and change the struct.
    The problem is I don't understand the items in red color. According the iMX6SoloX ReferenceManual NAND_DATA02 has as associated GPIO GPIO2_IO02, what means is in GPIO bank 2 , pin 02.
    So, what is that GPIO4 as base? Shouldn't it be GPIO2?.
    What is that 6 pin?. Shouldn't be 2?
    And why GPIO4 base is 0x420A8000U ? Where is all this explained?

    Thank you
     
  2. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    You don't need to change this value as it represent 'ATL5' which is 'GPIO pin muxing'.


    NAND_DATA02 can be pin mux'd to GPIO4_IO06, hence base is GPIO4 and the actual pin is 6. Each GPIO bank has 32 pins.

     
  3. PaulR

    PaulR New Member

    Joined:
    Dec 12, 2017
    Messages:
    9
    Likes Received:
    0
    Thanks jas-mx for your fast answer

    But in page 2121 of IMX6DQRM it says for NAND_DATA02, ALT5 function is GPIO2_IO02.
    GPIO4_IO06 is always associated with KEY_COL0 pad name, so i can't see any relation with it.
     
  4. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    You need to refer to the IMX6SXRM (i.MX 6SoloX Applications Processor Reference Manual) not IMX6DQRM .
     
  5. PaulR

    PaulR New Member

    Joined:
    Dec 12, 2017
    Messages:
    9
    Likes Received:
    0
    Ups..,that explains a lot of things...;)

    THANK YOU jas-imx.
     

Share This Page