ERROR ABOUT I.MX6Q GPIO TEST

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

ERROR ABOUT I.MX6Q GPIO TEST

跳至解决方案
3,222 次查看
浩卢
Contributor III

hi:

I've got some questions when I test I.mx6q gpio throgh the GPIO-SYSFS feature.

As a picture you can see below,

gpio_ctrl.png

No matter I input 1 or 0 into gpio199 value , the result is 0.

Pls hlep me ,tks.

*Notice : I've add this pin as gpio into pinctrl_hog in imx6qdl-sabresd.dtsi.

标签 (2)
标记 (1)
0 项奖励
回复
1 解答
2,957 次查看
BiyongSUN
NXP Employee
NXP Employee
11 回复数
2,957 次查看
BiyongSUN
NXP Employee
NXP Employee

Have you set the SION bit?

Please check the following ticket.

Simple GPIO Example - quandry | NXP Community

0 项奖励
回复
2,957 次查看
浩卢
Contributor III

I find the gpio expand by i2c can work fine.

You can see picture as below.

QQ图片20160822185330.png

0 项奖励
回复
2,958 次查看
BiyongSUN
NXP Employee
NXP Employee

I cut from  Simple GPIO Example - quandry  some for you.

Untitled.png

2,955 次查看
浩卢
Contributor III

QQ图片20160823112712.png

Hi

Biyong

I got it.

Tks for your reply. I'm a newer to linux devicetree.

0 项奖励
回复
2,955 次查看
BiyongSUN
NXP Employee
NXP Employee

Please read the Simple GPIO Example - quandry | NXP Community

In the ticket, some one also have quetion exactly the same like you.

And in the ticket, it gives an answer and also test in the i.MX6UL board.

2,955 次查看
BiyongSUN
NXP Employee
NXP Employee

Because in the i2c, it set the SION bit. as loopback clock.

When you change the fuction to GPIO. The SION still there.

Please check the SION bit.

2,955 次查看
浩卢
Contributor III

I've set

#define MX6QDL_PAD_GPIO_1__GPIO1_IO01               0x224 0x5f4 0x000 0x5 0x1

in the file imx6q-pinfunc.h

and set

MX6QDL_PAD_GPIO_1__GPIO1_IO01 0x80000000

in the file imx6qdl-sabresd.dtsi.

when I echo "0 or 1" > /sys/class/gpio/gpio1/value ,I can see the voltage changed 0->3V3 by using the multimeter .

But when I read the value (cat /sys/class/gpio/gpio1/value) , the result is always 0.

The gpio test is ok by used linux kernel-3.0.101.

@igorpadykov

QQ图片20160822163928.png

0 项奖励
回复
2,955 次查看
igorpadykov
NXP Employee
NXP Employee

please set echo in ../direction means that pad is configured

as input and then set input externally.

https://www.kernel.org/doc/Documentation/gpio/sysfs.txt

~igor

0 项奖励
回复
2,956 次查看
浩卢
Contributor III

Tks for your reply.

Since I set the GPIO1 input type (echo in > direction).

When I pull up GPIO1  ,I can read result 1 from (cat /sys/class/gpio/gpio1/value).

When I pull down GPIO1 ,I can read result 0 from (cat /sys/class/gpio/gpio1/value).

QQ图片20160822182321.png

So,it works ok when the gpio set input type.

But why it doesn't work when the gpio set output type?

0 项奖励
回复
2,956 次查看
BiyongSUN
NXP Employee
NXP Employee

Again here.

Have you set the SION bit?  "SION"

Please check the following ticket.

Simple GPIO Example - quandry | NXP Community

0 项奖励
回复
2,956 次查看
igorpadykov
NXP Employee
NXP Employee

Hi

echo out ../direction means that pad is configured

as output and one can check its signal with oscilloscope.

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复