• Hello,


    We are using buildroot-fsimx8x-B2020.09-pre on our Hardware and trying now to control GPIOs.


    I have received new document for GPIOs on iMX8 (efusMX8X-GPIO-ReferenceCard_eng.pdf) and tried to control GPIOs the same way as iMX6. with new gpio numbers there is no error anymore but no change on status of GPIOs as well.


    following is the example of how I try to control SPI_B_MOSI:


    Code
    1.  echo 494 > /sys/class/gpio/export
    2. echo out > /sys/class/gpio/gpio494/direction
    3. echo 0 > /sys/class/gpio/gpio494/value
    4. echo 1 > /sys/class/gpio/gpio494/value


    Can you please advise me if I missed something and why it is not still working.


    Thank you.

  • Hello,


    to use the GPIOs, the IOMUX registers of the pads must first be set to the GPIO. This is done in the device tree of the Linux kernel. Usually we have defines to enable or disable certain devices (e.g. SPI_B), but for the Pre-Release these are not yet prepared. When disabled we set the IOMUX to GPIO.


    For the 8X the following steps need to be done to set the pads to the GPIO in the Linux kernel source:


    - Under include/dt-bindings/pinctrl/pads-imx8qxp.h search for the define including the GPIO you want to use (e.g. search for GPIO0_IO15 and get SC_P_SPI3_SDI_LSIO_GPIO0_IO15)

    - Under arch/arm64/boot/dts/F+S/efusmx8x.dtsi you will find the node "pinctrl_hog: hoggrp". There you need to include the define with the values as in the IOMUX registers. (I included SPI_B_MOSI with "SC_P_SPI3_SDO_LSIO_GPIO0_IO14 0x06000021")

    - Load the right configuration for fsimx8x with "make fsimx8x_defconfig"

    - Build the device tree with "make F+S/efusmx8x.dtb"

    - Flash the new device tree on to the board


    Your F&S Support Team