How to access GPIO in iMX7ULP eval board

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

How to access GPIO in iMX7ULP eval board

3,113 Views
jaiganesh_sridh
Contributor III

Hello,

I am working with im7ulp eval kit and wondering how to access any GPIO from linux terminal. Usually, there will be GPIO bank and port number (like GPIO2_IO31 in imx6) which we would convert into GPIO number and access using /sys/class/gpio interface.

Is there any similar way to access GPIOs (Port C,D,E,F in imx7ulp ) from linux ? (Also, if possible, Port A and B from M4 domain)

PS: I am using L4.19.35_1.1.0 package.

Thanks,

Jai Ganesh Srihdaran

Labels (2)
Tags (2)
0 Kudos
Reply
7 Replies

2,946 Views
jaiganesh_sridh
Contributor III

I think I have found how it is numbered in imx7ulp. GPIO number 0 starts from port C (and this c port in linux sysfs consists of 32 GPIO pins of which only 0 to 19 are valid i.e upto PTC19 pad and others are invalid) and goes upto port F (upto 127) and starts again from port A followed by port B (128 to 191)

For example,

IMX7ULP_PAD_PTC10 -> GPIO number is 10
IMX7ULP_PAD_PTD0 -> GPIO number is 32
IMX7ULP_PAD_PTA0 -> GPIO number is 128
I got to know this by doing some research under systfs GPIO entries in linux terminal. 
I hope this is correct.

2,911 Views
Louson
Contributor I

I can confirm that, after exploring the reference manual. I don't think we can access to PTA and PTB from A7, but only from M4.

Ports have different availabilites :

  • PTC: 0 -> 19  = gpio0    -> gpio19
  • PTD: 0 -> 11  = gpio32 -> gpio43
  • PTE: 0 -> 15  = gpio64 -> gpio79
  • PTF: 0 -> 19  = gpio96 -> gpio115

 

 

0 Kudos
Reply

2,946 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jai

from imx7ulp.dtsi :

gpio_ptc: gpio@40ae0000 {
            compatible = "fsl,vf610-gpio";

imx7ulp.dtsi\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

one can try approach for vybrid processors:

Controlling GPIO from Linux User Space 

Controlling GPIO from Linux User Space 

For gpio M4 domain one can check access permissions defined by XRDC

described in Chapter 11 Extended Resource Domain Control (XRDC)

i.MX 7ULP Applications Processor Reference Manual

XRDC examples in MX7ULP SDK available on Welcome | MCUXpresso SDK Builder 

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

0 Kudos
Reply

2,946 Views
jaiganesh_sridh
Contributor III

Hello igorpadykov,

Thanks for your response. The links you shared provide how to use sysfs interface to access which is clear to me, provided, we know the GPIO number. My question is, how to convert from pad name to GPIO number in imx7ulp ?

For example, if I configure PTE14 to be a GPIO, how do i convert that to a GPIO number so that I can access via sysfs interfaces ?

Thanks,

Jai Ganesh Sridharan

0 Kudos
Reply

2,946 Views
igorpadykov
NXP Employee
NXP Employee

Hi Jay

seems numbering if provided in imx7ulp-pinfunc.h (first, second. e.t.c.)

imx7ulp-pinfunc.h\dts\boot\arm\arch - linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos
Reply

2,946 Views
jaiganesh_sridh
Contributor III

Hello Igor,

Exactly correct. Through pinfunc.h file in device tree we can derive GPIO number, but that is not true in imx7ulp case. If you can see the file you mentioned, lets take two examples: (PTE13 and PTF13)

IMX7ULP_PAD_PTE13__PTE13
IMX7ULP_PAD_PTF13__PTF13                                     

Both have numbers 13 (Port E and Port F) .  How do I convert them into a GPIO number that i can export into sysfs GPIO path and use ?

Thanks,

Jai Ganesh Sridharan

0 Kudos
Reply

2,946 Views
igorpadykov
NXP Employee
NXP Employee
0 Kudos
Reply