GPIO Configuration

Hi,

I’ve to set one of the outputs on 3,3V
I’ve read an article for .Net Core

and used this sample for my programm. I’ve changed gpoiBank to 0 and PIn to 14. According documentation it means SODIMM_66 (LSIO.GPIO0.IO14). Then I have connected A31 (SODIMM_66 ) to LED1 (X21/2).
But it always on, there is no difference, whether I send gpioController.Write(gpioLine, PinValue.Low) or gpioController.Write(gpioLine, PinValue.High);
I suppose it configured as input and won’t accept the command gpioController.OpenPin(gpioLine, PinMode.Output);
I set all properties in the Torizon tab like in this article, but it dies not work.

Do I have addidtionally to config somthing also?

Greetings @programmier-hirsch,

So the issue here is that you need to take note of what the default function of a particular pin is. While all/most of the pins on our modules can be utilized as GPIOs, typically they serve some default purpose other than this. You can look up a pin’s default function either via the datasheet or in the device tree.

For SODIMM 66 as seen here in the device tree: http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm64/boot/dts/freescale/imx8qxp-colibri.dtsi?h=toradex_5.4-2.1.x-imx#n765

Is being used as on of the pins for the parallel RGB interface. If you want to use this particular pin as a GPIO you’ll need to remove it from this interface and then redefine it as a GPIO. But then the parallel RGB interface won’t be working which will disable all related displays interfaces. If you want both display and this pin as a GPIO you’ll need to shuffle pins around such that you find a pin that can replace this one.

Best Regards,
Jeremias

Thank you @jeremias.tx ,

I don’t need this specifical pin, I have to set any pin on in oder to initiate some external operation.
I’ve tried some different pins already but no one has worked for me.
Now I’ve opened pinout designer and selected SODIMM_92 (GPIO1.IO01) B35 on Colibri Evaluation Board.
Do you think it should work?
Do I need some additional configuration?

SODIMM 92 is used by the SPI interface as seen here: http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm64/boot/dts/freescale/imx8qxp-colibri.dtsi?h=toradex_5.4-2.1.x-imx#n914

The default GPIO assignments are any pinctrl group that is listed in pinctrl-0 here: http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm64/boot/dts/freescale/imx8qxp-colibri.dtsi?h=toradex_5.4-2.1.x-imx#n454

Best Regards,
Jeremias

@jeremias.tx, but how I can find a free GPIO output pin for my system? Practically all pins are already in use.
And some that looks free (69, 71,73) are FASTD and not GPIO, accordig Colibri iMX8X Datashit

Dear @programmier-hirsch,

in your first message you mentioned SODIMM_66 (LSIO.GPIO0.IO14) and as Jeremias mentioned this pin used for the RGB parallel interface. Do you use that interface on your setup?

If not, it should be possible for you to configure this pin as the GPIO for your external control pin. Would it be possible for you to attach a “dmesg” log?

Best Regards,
Kevin

Dear @kevin.tx ,
I’m totally new in the Linux world, so I have a lot of problems on it.
Is it possible to use some “standard” free pin for setting an output signal?

I haven’t changed the default configuration of Torizon.
Now I’ve opened connection with PuTTY, created file using dmesg and attached hier link text
Is it that you need?
Thank you,
Dmitry Peskin

As I said the best way to know the function of any pin on the system is to check the device tree source for that hardware.

This is he source device tree for i.MX8X: http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm64/boot/dts/freescale/imx8qxp-colibri.dtsi?h=toradex_5.4-2.1.x-imx#n454

Notice the pinctrl-0 field under the iomuxc node. Any groups listed in this field are GPIOs by default. For example we see pinctrl_hog1 listed. We search the file for this group and find it here: http://git.toradex.com/cgit/linux-toradex.git/tree/arch/arm64/boot/dts/freescale/imx8qxp-colibri.dtsi?h=toradex_5.4-2.1.x-imx#n571

All the SODIMM pins in this group should be defaulted to GPIOs.

Best Regards,
Jeremias

@jeremias.tx,

thank you for you patience!
So in this group I have some candidats. I’ve checked in the Colibri Datasheet as well and on the page 25 I’ve found a table SODIMM.

For the Pin 95 I have a row
95 QSPI0B_SCLK AR11 LSIO.QSPI0B.SCLK LSIO.QSPI1A.SCLK LSIO.KPP0.COL0 LSIO.GPIO3.IO17 FASTD ALT4
Is it okey to use FASTD?


I can see also the Pin 103.
Why do you have two rows for this pin?
IMX8QXP_SAI0_TXD_LSIO_GPIO0_IO25 0x20 /* SODIMM 103 /
MX8QXP_CSI_D01_CI_PI_D03 0x61 /
SODIMM 103 */

And in the Datasheet I can see, that the default mode for this Pin is ALT0. Does it mean what in the Datasheet are included all possible variants and in the imx8qxp-colibri.dtsi I can see or change the real configuration?

Pins of FASTD types should be okay to use. These are still GPIOs it just denotes extra functionality overt standard GPIO pins.

As for SODIMM 103 it’s a little complicated but essentially this pin has two balls from the SoC multiplexed on one pin in the SODIMM connector. See page 22 of the datasheet for more details on this.

And in the Datasheet I can see, that the default mode for this Pin is ALT0.

What the highlights on the SODIMM list denote are “The alternate functions,which are used to provide the primary interfacesto ensure the best compatibility with other Colibri modules are highlighted.”

Always consult with the device tree source for the actual default values of a pin. The device tree is ultimately what decides how each pin is used in Linux.

Best Regards,
Jeremias

Tnank you @jeremias.tx!

I’ve found two pins in the one GPIO bank (3/17 and 18), which work for me.

Best regards,
Dmitry Peskin

Glad I was able to help explain things!

Best Regards,
Jeremias