Gpiod waiting on pin event

Hello,

I’m trying to use a Colibri iMX8X pin mounted on an aster carrier board in order to wait for the rising edge of the input.

I want to use pin 6 of the x17 connector as input, the manual indicates that it corresponds to SODIMM_28.

I’m using the Linux version “TDX Wayland with XWayland 5.7.1-devel-20230108093713+build.0 (dunfell)”.

I have not configured any pins in the device tree.

I tried using the gpio-event.c application passing the parameters SODIMM_28 SODIMM_30 as input

While moving the SODIMM_28 pin signal low to high several times the function gpiod_line_event_wait the function never returns.

What could be the cause of the malfunction and how can I fix it.

Thank you for your help.

Best regards

Flavio Gobber

Hello @flavio,

Thanks for reaching out and also sorry for the delay it took in answering your question.

The easiest way to solve this would be to create a device tree overlay to set the GPIO Functionality to the pin (in your case SODIMM_28). Here is a good read on how to create the overlay file and build it: Pin Multiplexing - Changing Pin Functionalities in the Linux Device Tree | Toradex Developer Center

From the datasheet of Colibri iMX8X, page number 26 you can see that SoC ball name for pin SODIMM 28 is UART1_TX. This should be your starting point.

Just to make it easier for you, I wrote an overlay file that you could test:

/dts-v1/;
/plugin/;

/{
        compatible = "toradex,colibri-imx8x";
};

&pwm0 {
    status = "disabled";
};

&iomuxc {
    pinctrl-0 = <&pinctrl_xablau>;

    colibri-imx8x{
        pinctrl_xablau: xablau-adapter {
                fsl,pins = <
                        IMX8QXP_UART1_TX_LSIO_GPIO0_IO21        0x4000021
                >;
        };
   };
};

Please note: You should also add other pin controls that you need into iomuxc. Also, the bit configuration value for the SODIMM_28 pin depends on your use case and can be derived from the reference manual of i.MX8X Processor (section GPIO, from the fields table of pin UART1_TX ) which you can download from NXP website.

Please let me know if this could help :slight_smile:

Hello rudhi,

I have tested you suggestion and it works well.

Thank you for help.

Regards.

Flavio