i.MX6 output gpio value behaviour

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

i.MX6 output gpio value behaviour

Jump to solution
4,711 Views
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

Labels (4)
1 Solution
1,568 Views
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

View solution in original post

2 Replies
1,568 Views
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 Kudos
Reply
1,569 Views
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