How to toggle a GPIO Pin in I.Mx8mmini

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to toggle a GPIO Pin in I.Mx8mmini

3,119件の閲覧回数
santhosh2
Contributor IV

Hi,

I want to  toggle a GPIO Pin in I.Mx8mmini to control read write operation. How to write a simple application code to do this

Regards

Santhosh Kumar S

0 件の賞賛
返信
3 返答(返信)

2,698件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Santhosh

one can refer to sect.2.1.6 General Purpose Input/Output (GPIO)

attached Linux Manual.

Best regards
igor

0 件の賞賛
返信

2,698件の閲覧回数
santhosh2
Contributor IV

Hi.,

Attachment is missing

0 件の賞賛
返信

2,698件の閲覧回数
peter_tian
NXP Employee
NXP Employee

Hello Santhosh Kumar S,

You can try the way as following:

1. Make sure the pad mux is GPIO ALT in dts.

2. Linux Userspace Naming Conversion

Linux gpio number = (gpio_bank - 1) * 32 + gpio_bit

For example, for gpiom_n, num=32 * (m-1) + n.

3. Input command to your Linux console

/* export gpio */

echo num > /sys/class/gpio/export

/* set the direction of gpio as output */

echo out > /sys/class/gpio/gpio[num]/direction

/* output low level */

echo 0 > /sys/class/gpio/gpio[num]/value

/* output high level */

echo 1 > /sys/class/gpio/gpio[num]/value

Best Regards,

Peter

0 件の賞賛
返信