GPIO state changing after sleep

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

GPIO state changing after sleep

2,466件の閲覧回数
Tanushree
Contributor III

Hello,

I'm trying to toggle the IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 GPIO by exporting it, but when the device enters sleep mode, the GPIO doesn't retain its state when we probed.
Processor - IMX8DXL
Kernel version - 5.15.52
commands used-  echo 113 > /sys/class/gpio/export
                                   echo out > /sys/class/gpio/gpio113/direction
                                   echo 1 > /sys/class/gpio/gpio113/value                                  

                                 echo mem > /sys/power/state

 

 Regards,
Tanushree

ラベル(1)
タグ(1)
0 件の賞賛
返信
12 返答(返信)

1,932件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

sorry for my late response, I've mailed to and explain this, pls check

0 件の賞賛
返信

2,434件の閲覧回数
gidame
Contributor III

You can try to set LATCH to keep the state when goes into low power.

9.2.5.1.139 QSPI0B_SCLK (QSPI0B_SCLK)

h.png

0 件の賞賛
返信

2,347件の閲覧回数
matato
Contributor I


I think gidame's answer is completely correct. There is such an example in NXP BSP.

https://github.com/nxp-imx/linux-imx/blob/rel_imx_4.14.98_2.0.0_ga/arch/arm64/boot/dts/freescale/fsl...

 

	modem_reset: modem-reset {
		compatible = "gpio-reset";
		pinctrl-names = "default", "sleep";
		pinctrl-0 = <&pinctrl_modem_reset>;
		pinctrl-1 = <&pinctrl_modem_reset_sleep>;
		reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
		reset-delay-us = <2000>;
		reset-post-delay-ms = <40>;
		#reset-cells = <0>;
	};
		pinctrl_modem_reset: modemresetgrp {
			fsl,pins = <
				SC_P_QSPI1A_DQS_LSIO_GPIO4_IO22		0x06000021
			>;
		};

		pinctrl_modem_reset_sleep: modemreset_sleepgrp {
			fsl,pins = <
				SC_P_QSPI1A_DQS_LSIO_GPIO4_IO22		0x07800021
			>;
		};

 

 

0 件の賞賛
返信

2,437件の閲覧回数
joanxie
NXP TechSupport
NXP TechSupport

could you reproduce this on nxp board? if yes, what result do you get when board go to sleep mode?

0 件の賞賛
返信

2,365件の閲覧回数
Tanushree
Contributor III

We have connected the GPIO(QSPI0B_SCLK) for regulator switch to the modem. By default, the GPIO is in a low state, which keeps the modem powered on. To save power, we set the GPIO to a high state, causing the modem to disconnect during sleep. However, when the device enters sleep mode, the GPIO automatically changed to a low state.

We also attempted to set the GPIO configuration to "latch." But we are not able to toggle the GPIO it is in low state only.

タグ(1)
0 件の賞賛
返信

2,305件の閲覧回数
xakira
Contributor I

Accoding to gidame and matato' inputs, and you need to control the gpio from use space. The follow should be tried.

Replacing IMX8DXL_SNVS_TAMPER_OUT1_LSIO_GPIO2_IO05_IN with the pin you are using.

The Linux will switch the the "sleep" pin configuration automatically, when gets into suspend.

https://github.com/nxp-imx/linux-imx/blob/lf-5.15.52-2.1.0/arch/arm64/boot/dts/freescale/imx8dxl-evk...

&iomuxc {
	pinctrl-names = "default" "sleep";
	pinctrl-0 = <&pinctrl_hog>;
    pinctrl-1 = <&pinctrl_hog_sleep>;
	
	pinctrl_hog: hoggrp {
		fsl,pins = <
			IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD	0x000514a0
			IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHK_PAD	0x000014a0
			IMX8DXL_SPI3_CS0_ADMA_ACM_MCLK_OUT1		0x0600004c
			IMX8DXL_SNVS_TAMPER_OUT1_LSIO_GPIO2_IO05_IN	0x0600004c
		>;
	};

	
	pinctrl_hog_sleep: hogsleepgrp {
		fsl,pins = <
			
			IMX8DXL_SNVS_TAMPER_OUT1_LSIO_GPIO2_IO05_IN	0x0780004c
		>;
	};

 

0 件の賞賛
返信

2,260件の閲覧回数
Tanushree
Contributor III

Hello All,

Thank you for the inputs.

Even after adding the configurations below in the DTS file, the GPIO state still does not retain.

pinctrl-names = "default","sleep";
pinctrl-0 = <&pinctrl_hog>;
pinctrl-1 = <&pinctrl_hog_sleep>;

pinctrl_hog: hoggrp {
fsl,pins = <
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x2600004c
>;
};

pinctrl_hog_sleep: hogsleepgrp {
fsl,pins = <
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x2780004c
>;
};
During boot-up, the GPIO is in a low state, and in userspace, it is setting to high. However, when the device enters sleep mode, the GPIO does not retain its state and defaults back to low.

Regards,
Tanushree

タグ(1)
0 件の賞賛
返信

2,185件の閲覧回数
xacov
Contributor I

I don't know the specific hardware design of your board, but it is usually pull up. xakira just gave an example, you still have to make corresponding modifications according to your own hardware design.

 

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x26000021

 

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x27800021

0 件の賞賛
返信

2,063件の閲覧回数
Tanushree
Contributor III

Hello @xacov 

In our hardware design, we have not connected any pull-up or pull-down resistors to the GPIOs. However, based on the general i.MX documentation, it mentions that there are two types of GPIOs, and some of them may not retain their state. I also observed that when I tried using GPIOs other than the QSPI0B signal, the state of those GPIOs was retained during the sleep state. If that is the case, how can we identify those GPIOs, since the i.MX8DXL reference manual does not mention this information?

image.png

タグ(1)
0 件の賞賛
返信

2,055件の閲覧回数
xakira
Contributor I

1. the pull up/pull down settings is not related to the extenal design. it is related to the power domain supply.  The external pull-up only increases the driving strength. 

2. To my knowledge, iMX8ULP is quite different design to iMX8DXL.

d21.png

0 件の賞賛
返信

2,015件の閲覧回数
Tanushree
Contributor III

Hello,

Have you tested it on the EVK? Could you please provide the working configurations? I'm having trouble retaining the GPIO state during sleep.

Below is the dts and GPIO configuration.

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0xA6000020

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0xA7800020

configuration.png

タグ(1)
0 件の賞賛
返信

1,881件の閲覧回数
xacov
Contributor I

Is your board hardware designed to pull down? If not, then it is generally necessary to pull up.

 

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x26000021

 

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x27800021

 

or

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x26000020

 

IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x27800020

0 件の賞賛
返信