imx.6 GPIO

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

imx.6 GPIO

Jump to solution
20,214 Views
akea
Contributor I

Hi,

I am using sysfs(linux L3.0.15_12.04.01_ER_source)  to set a GPIO as an output with the following commands:

echo 163 > /sys/class/gpio/export

echo out > /sys/class/gpio/gpio163/direction

echo 1 > /sys/class/gpio/gpio163/value

I measured the output voltage and it works correctly. The problem is that when I do cat "/sys/class/gpio/gpio163/value". It always returns 0. Any ideas?

I was digging through the gpio driver and the gpio value is read from  GPIO_PSR. If I read GPIOX_PSR with memtool also returns 0. Reading GPIO_DR returns the correct value. I am new to the imx.6 family. Is this normal?

Thanks,


Labels (1)
Tags (1)
1 Solution
3,632 Views
DuanFugang
NXP Employee
NXP Employee

hi, Ake,

It is normal.

For imx6 GPIO function:

GPIO Read Mode:Read value from data register/pad status register(PSR)

GPIO Write Mode:Write value to data register (GPIO_DR).

If GDIR[n] is set and IOMUXC input mode is GPIO, then reading DR[n] returns the contents of DR[n].

If GDIR[n] is cleared and IOMUXC input mode is GPIO, then reading DR[n] returns the corresponding input signal‘s value.

Thanks,

Andy

View solution in original post

5 Replies
3,633 Views
DuanFugang
NXP Employee
NXP Employee

hi, Ake,

It is normal.

For imx6 GPIO function:

GPIO Read Mode:Read value from data register/pad status register(PSR)

GPIO Write Mode:Write value to data register (GPIO_DR).

If GDIR[n] is set and IOMUXC input mode is GPIO, then reading DR[n] returns the contents of DR[n].

If GDIR[n] is cleared and IOMUXC input mode is GPIO, then reading DR[n] returns the corresponding input signal‘s value.

Thanks,

Andy

3,632 Views
luongnguyen
Contributor II

Hi Fugang,

I want change mode of GPIO1 from ESAI to GPIO,

how we can write/read value of IOMUXC_SW_MUX_CTL_PAD_GPIO01 register by software or terminal. i'm using I.MX6Q

Thanks and regard,

0 Kudos
3,632 Views
bhayani_sunny
Contributor III

Hi,

I am using iMX6SLEVK.

I want to use MX6SL_PAD_EPDC_D7_GPIO_1_14 as GPIO.

I am also using the above method which Antonio has mentioned, but I am not seeing any voltage on this pin (SOC Pin C15).

Can you please let me know how to configure this as output.

I have even tried to add this pin to the arch/arm/boot/dts/imx6sl-evk.dts - hoggrp and have tried with values 0x80000000 and 0x1b0b0, but still no use.

Please do let me know if I need to check anything else.

Thanks,
Sunny

0 Kudos
3,632 Views
bhayani_sunny
Contributor III

Hi,

I am able to configure the GPIO from userspace from /sys/class/gpio.

I did changes in the arch/arm/boot/dts/imx6sl-evk.dts file.

I added the below lines in the hoggrp for iomuxc group:

     MX6SL_PAD_EPDC_D7__GPIO1_IO14     0x110b0

     MX6SL_PAD_EPDC_D6__GPIO1_IO13     0x110b0

But can anybody please let me know, what the above values mean. Because I tried to use this pins with the values -->0x1b0b0 and 0x80000000, but it was not working for me.

Then I referred to the BSP Porting Guide for iMX6SL and there it is mentioned that the values corresponds to Hysteresis, Pull up/Pull down, etc but I am not able to see exact bit mappings for the above values.

It would be great if someone can point me out to the values.

Thanks,

Sunny

0 Kudos
3,632 Views
fkilleen
Contributor I

Hello,

You can use the IO Mux tool to quickly visualize what each mapping represents.

From what I can see, going from 0x1b0b0 to 0x110b0 is actually 100k pull up to 100k pull down and pull mode to keep mode.

0 Kudos