i.MX6 output gpio value behaviour

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

i.MX6 output gpio value behaviour

跳至解决方案
5,373 次查看
yurirellosa
Contributor IV

Hello Community,

I am migrating code from L3.0.35 to L3.10.17 and on both cases I am using the function gpio_direction_output(); and gpio_export(); on the board file to export gpio pins on sysfs.

On L3.0.35 when I change a pin value, i.e. from 0 -> 1, with echo and look into it, the value reads as 1. But on L3.10.17 when I apply echo on the value then read it, the value always return a 0 value.

But on both cases, devices attached on the out gpio functions properly. Echo 1 on a gpio output to a LED and turns on on both cases.

Is returning to 0 on gpio values on L3.10.17 normal behaviour for this version? Is there a way for the value to maintain its "current" value?

Best Regards

Yuri

标签 (4)
1 解答
2,230 次查看
yurirellosa
Contributor IV

Hello Carlos,

Thank you for your reply.

Sorry if my question seems vague, but I actually don't have problem with adding output GPIO, it currently works fine with the device.

The problem was when reading the value for the output GPIO it only comes back as [0].

Anyway, I have looked into the gpio drivers on both linux versions. On L3.0.35 output gpio returns GPIO_DR and input return GPIO_PSR.

It seems on L3.10.17 the value is now only mapped to get GPIO_PSR.

Also I found this thread: http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/272037.html

For output GPIO's I have set the SION bit on the device tree (0x40000000) and that seem to have solved the problem

Best Regards

Yuri

在原帖中查看解决方案

2 回复数
2,230 次查看
CarlosCasillas
NXP Employee
NXP Employee

Hi Yuri,

You could take a look at the following thread, where it is mentioned how to configure GPIOs on SABRE SD:

https://community.freescale.com/message/467019


Hope this will be useful for you.
Best regards!
/Carlos

0 项奖励
回复
2,231 次查看
yurirellosa
Contributor IV

Hello Carlos,

Thank you for your reply.

Sorry if my question seems vague, but I actually don't have problem with adding output GPIO, it currently works fine with the device.

The problem was when reading the value for the output GPIO it only comes back as [0].

Anyway, I have looked into the gpio drivers on both linux versions. On L3.0.35 output gpio returns GPIO_DR and input return GPIO_PSR.

It seems on L3.10.17 the value is now only mapped to get GPIO_PSR.

Also I found this thread: http://lists.infradead.org/pipermail/linux-arm-kernel/2014-July/272037.html

For output GPIO's I have set the SION bit on the device tree (0x40000000) and that seem to have solved the problem

Best Regards

Yuri