Cannot control GPIO2 from Cortex-M7

  • Hello,


    I can successfully control ports of GPIO1 and GPIO5 from the Cortex-M7 by using freertos-sdk-2.10.0-fsimx8mp-V2022.07.1 SDK. Basically, the code is the same as in the led_output example of the SDK. However, it does not work for ports from GPIO2 (didn't try GPIO3 and GPIO4 yet). I've selected pads SD_B_WP and SD_B_CD, because their signals are available on pins of the J11 connector of the evaluation carrier board, so I can test the result.


    First, I've disabled SD_B in the Linux device tree (Linux is running in parallel on the A53 cores):


    #undef CONFIG_PICOCOREMX8MP_SD_B

    #undef CONFIG_PICOCOREMX8MP_SD_B_CD

    #undef CONFIG_PICOCOREMX8MP_SD_B_WP


    The code for the M7 looks like this:


    IOMUXC_SetPinMux(IOMUXC_SD2_CD_B_GPIO2_IO12, 0U);

    GPIO2->GDIR = (1ul << 12);

    GPIO2->DR = (1ul << 12);


    This code should set the regarding pin to high, but nothing happens. The same code works fine for ports from GPIO1 and GPIO5. Interestingly, even after configuring the port as "output", the value of GPIO2->GDIR remains '0' when I read it out after the code above has been executed. For GPIO1 and GPIO5, the value reflects what I have written to the register.


    Maybe I missed something fundamental, but currently I have no idea what is wrong.

  • If all accesses to GPIO2 pins are disabled in Linux, maybe also the clock of GPIO2 stays disabled. Then you also have to activate the clock for GPIO2 (CCGR12) on the Cortex-M.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

  • On PicoCoreMX8MP-V4 the SD_B Signals are not connected to the Baseboard. The Reason is that they are used for the WLAN/BT-Module on the PicoCore. So unfortunatly you cannot use this GPIO on your Board.


    Your F&S Support Team

    F&S Elektronik Systeme GmbH
    As this is an international forum, please try to post in English.
    Da dies ein internationales Forum ist, bitten wir darum, Beiträge möglichst in Englisch zu verfassen.

    Edited once, last by fs-support_PG ().

  • Thanks a lot, both answers help. The clock was indeed not enabled, and after fixing this the GDIR contains the expected values after writing/reading it. And the 2nd answer explains why I nevertheless can't measure a signal.