Use SPI device pins as GPIO

  • Hi,


    I'm trying to use pins 12, 14, 16, 17 (of the 66 pins connector) as GPIO output.
    First I've used the /sys/class/gpio interface.
    Then I've tested a C program that directly writes into the registers.
    The result is the same.
    I can only change the status of pin 14.
    Pins 12, 16, 17 are always high.


    Any suggestion?


    This is my test C program:


  • Hi,


    The pins are used for SPI by default. So the internal iomux-controller of the SOC is configured to bring the SPI signals to the pads. Pin 14 works because it is used as chip select which is in fact a GPIO.
    The other pins can't work, especially when testing with /sys/class...


    The common way to configure the iomux controller is by editing the device tree.
    You have to deactivate SPI_A and configure every of the four pins as GPIO. (Also No. 14 must be configured because it will also be disabled when deactivating SPI_A.)


    This is how the configuration is done in the device tree:


    - Deactivate SPI_A: remove/comment CONFIG_ARMSTONEA9_SPI_A in arch/arm/boot/dts/armstonea9dl.dts
    (Solo/DualLite) or arch/arm/boot/dts/armstonea9q.dts (Dual/Quad) depending on the processor you have.


    - Open the file arch/arm/boot/dts/armstonea9qdl.dtsi and go to the ' pinctrl_hog_1' node. Here you can see
    some pads that are configured as GPIO. Here you have to set every pin.
    E.G. for pin 14 it looks like this:


    MX6QDL_PAD_EIM_RW__GPIO2_IO26 0x80000000


    - Recompile the devicetree and install it on the board.



    Best Regards
    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_PH ().

  • Dear Mr. Dgrechi,


    thanks for this hint. I checked the pins and found out that we have something wrong in our document "armStoneA9-GPIO-ReferenceCard_eng.pdf". The GPIO3IO16, GPIO3IO17, GPIO3IO18 were wrong documented. I fixed this document and uploaded it to our server. Now you can download the newest version from our homepage. Download link below:
    https://www.fs-net.de/assets/d…PIO-ReferenceCard_eng.pdf


    Best Regards
    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.

  • Thank you for the reply.


    I'm using fsimx6-V2.1 without Device Tree.
    So I'm trying to directly program the i.mx6 resgisters.


    I've configured the "ALT5" (0x5) function in the iomux registers related to 12, 14, 16, 17 pins (EIM_D16, EIM_RW, EIM_D17, EIM_D18 respectively): this should configure pins as GPIO.


    Then I've set the output direction through the GPIOx_GDIR registers.


    But, as I mentioned, I can't change the EIM16, EIM_D17, EIM_D18 status.


    What is missing?