GPIO configurations in IMX8QXP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO configurations in IMX8QXP

1,367 Views
jnj
Contributor III

Hi All,

I am currently working on the i.MX8QXP EVK board. I want to configure the FLEXCAN2_TX pin as LSIO_GPIO1_IO20 output with an initial state of 1. FLEXCAN2_TX was initially configured as UART3_TX, so I removed the following configurations related to UART3_TX from imx8x-mek.dtsi:


&lpuart3 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lpuart3>;
status = "okay";
};

pinctrl_lpuart3: lpuart3grp {
fsl,pins = <
IMX8QXP_FLEXCAN2_TX_ADMA_UART3_TX 0x06000020
IMX8QXP_FLEXCAN2_RX_ADMA_UART3_RX 0x06000020
>;
};
I also added the following configurations in imx8qxp-mek.dts:


&lsio_gpio1 {
pinctrl-names = "default";
pinctrl-0 = <&test_gpio>;
status = "okay";
test_gpio: gpio_val_test {
fsl,pins = <IMX8QXP_FLEXCAN2_TX_LSIO_GPIO1_IO20 0x20>;
};
};
I obtained the value 0x20 from the configuration tool. However, after flashing the image, the sysfs entry for gpio52 still shows the direction as input. Please correct me where I went wrong."

Thanks in advance!

0 Kudos
Reply
10 Replies

1,248 Views
jnj
Contributor III

Hi @Alejandro_Salas , 

Could you please share your dts Or dtsi file. So that I can refer to it. 

0 Kudos
Reply

1,343 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello @jnj ,

I hope you are doing well.

 

Could you please try with:

 

IMX8QXP_FLEXCAN2_TX_LSIO_GPIO1_IO20 0x20000040

 

Best regards!

 

Salas.

 

0 Kudos
Reply

1,338 Views
jnj
Contributor III

Hi @Alejandro_Salas ,

Thank you for the response.I have tried the above mentioned  changes.But still the GPIO direction while reading is "in" instead of "out".I am not sure on which register in the reference manual should I refer for this.I changed the configuration using the config tool and corresponding changes in the dts file is mapped to the device dts file.Kindly guide me.

jnj_0-1707893405606.png

sysfs number is calculated based on the below calculation ,

IMX8QXP_FLEXCAN2_TX_LSIO_GPIO1_IO20 belongs to gpio1 controller and hence comes in the bank gpiochip32.hence sysfs gpio number = 32+20=52

0 Kudos
Reply

1,332 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello @jnj 

 

In reference manual you can look the GDIR register:

Alejandro_Salas_0-1707933943657.pngAlejandro_Salas_1-1707933965934.pngAlejandro_Salas_2-1707933978889.png

 

I am trying to replicate your issue but unsuccessfully.

 

Could you please share your device tree to try boot with it?

 

Best regards!

 

Salas.

 

0 Kudos
Reply

1,305 Views
jnj
Contributor III

Hi @Alejandro_Salas ,

I have attached the dtsi file where I made changes for the gpio and dtb file.Kindly go through it. Could you share me your dts and dtb file?I will check here also.

0 Kudos
Reply

1,278 Views
jnj
Contributor III

Hi @Alejandro_Salas ,

Could you please help me here?

0 Kudos
Reply

1,258 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello @jnj ,

 

Apologies for delay.

I am trying to replicate the issue but unsuccesfully. 

One question, what BSP version are you using?

Have you tried with gpiod? for example, typing in command line:

$gpioinfo

 

Best regards.

 

Salas.

0 Kudos
Reply

1,255 Views
jnj
Contributor III

Hi @Alejandro_Salas , 

I could control the gpio direction and value by using echo command and sysfs gpio number.But from dts configuration I couldn't control the initial state of gpio ie output and value =1.I am using linux kernel version 5.15.17 Kirkstone

 

0 Kudos
Reply

1,248 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello @jnj 

 

Good to hear that.

To manipulate the initial state of GPIOs during boot one can try the gpio-hog driver.

 

Best regards!

 

Salas.

0 Kudos
Reply

1,246 Views
jnj
Contributor III

Hi @Alejandro_Salas , 

Thank you for the response. Let me check and get back to you. 

0 Kudos
Reply