0
Sp0T

Can someone clear this GPIO thing?

Recommended Posts

Hello Everyone,

 

I would like to play with my A20 board a bit and would like to use the GPIOs. I checked the forum but it's still not clear what to do and how. Can someone explain to me how to get for example pin 16 on the board?

 

This is the fex:

Spoiler

[gpio_para]
gpio_used = 1
gpio_num = 88
gpio_pin_1 = port:PB20<1><default><default><default>
gpio_pin_2 = port:PB21<1><default><default><default>
gpio_pin_3 = port:PB20<1><default><default><default>
gpio_pin_4 = port:PI03<1><default><default><default>
gpio_pin_5 = port:PB22<1><default><default><default>
gpio_pin_6 = port:PB23<1><default><default><default>
gpio_pin_7 = port:PI14<1><default><default><default>
gpio_pin_8 = port:PI10<1><default><default><default>
gpio_pin_9 = port:PI13<1><default><default><default>
gpio_pin_10 = port:PI12<1><default><default><default>
gpio_pin_11 = port:PI11<1><default><default><default>
gpio_pin_12 = port:PH05<1><default><default><default>
gpio_pin_13 = port:PH03<1><default><default><default>
gpio_pin_14 = port:PH00<1><default><default><default>
gpio_pin_15 = port:PH01<1><default><default><default>
gpio_pin_16 = port:PH01<1><default><default><default>
gpio_pin_17 = port:PI19<1><default><default><default>
gpio_pin_18 = port:PH02<1><default><default><default>
gpio_pin_19 = port:PH02<1><default><default><default>
gpio_pin_20 = port:PI20<1><default><default><default>
gpio_pin_21 = port:PI21<1><default><default><default>
gpio_pin_22 = port:PI17<1><default><default><default>
gpio_pin_23 = port:PH20<1><default><default><default>
gpio_pin_24 = port:PH21<1><default><default><default>
gpio_pin_25 = port:PI16<1><default><default><default>
gpio_pin_26 = port:PI16<1><default><default><default>
gpio_pin_27 = port:PI18<1><default><default><default>
gpio_pin_28 = port:PH05<1><default><default><default>
gpio_pin_29 = port:PI21<1><default><default><default>
gpio_pin_30 = port:PH03<1><default><default><default>
gpio_pin_31 = port:PI20<1><default><default><default>
gpio_pin_32 = port:PH17<1><default><default><default>
gpio_pin_33 = port:PB19<1><default><default><default>
gpio_pin_34 = port:PB18<1><default><default><default>
gpio_pin_35 = port:PH19<1><default><default><default>
gpio_pin_36 = port:PE00<1><default><default><default>
gpio_pin_37 = port:PH16<1><default><default><default>
gpio_pin_38 = port:PE01<1><default><default><default>
gpio_pin_39 = port:PH14<1><default><default><default>
gpio_pin_40 = port:PE03<1><default><default><default>
gpio_pin_41 = port:PE02<1><default><default><default>
gpio_pin_42 = port:PH18<1><default><default><default>
gpio_pin_43 = port:PH11<1><default><default><default>
gpio_pin_44 = port:PE04<1><default><default><default>
gpio_pin_45 = port:PE05<1><default><default><default>
gpio_pin_46 = port:PE06<1><default><default><default>
gpio_pin_47 = port:PE07<1><default><default><default>
gpio_pin_48 = port:PE08<1><default><default><default>
gpio_pin_49 = port:PE09<1><default><default><default>
gpio_pin_50 = port:PE10<1><default><default><default>
gpio_pin_51 = port:PE11<1><default><default><default>
gpio_pin_52 = port:PH13<1><default><default><default>
gpio_pin_53 = port:PI01<1><default><default><default>
gpio_pin_54 = port:PI00<1><default><default><default>
gpio_pin_55 = port:PH07<1><default><default><default>
gpio_pin_56 = port:PH08<1><default><default><default>
gpio_pin_57 = port:PB02<1><default><default><default>
gpio_pin_58 = port:PH09<1><default><default><default>
gpio_pin_59 = port:PD25<1><default><default><default>
gpio_pin_60 = port:PD27<1><default><default><default>
gpio_pin_61 = port:PD26<1><default><default><default>
gpio_pin_62 = port:PH06<1><default><default><default>
gpio_pin_63 = port:PD24<1><default><default><default>
gpio_pin_64 = port:PD23<1><default><default><default>
gpio_pin_65 = port:PD22<1><default><default><default>
gpio_pin_66 = port:PD21<1><default><default><default>
gpio_pin_67 = port:PD20<1><default><default><default>
gpio_pin_68 = port:PD19<1><default><default><default>
gpio_pin_69 = port:PD18<1><default><default><default>
gpio_pin_70 = port:PD17<1><default><default><default>
gpio_pin_71 = port:PD16<1><default><default><default>
gpio_pin_72 = port:PH12<1><default><default><default>
gpio_pin_73 = port:PD00<1><default><default><default>
gpio_pin_74 = port:PD01<1><default><default><default>
gpio_pin_75 = port:PD02<1><default><default><default>
gpio_pin_76 = port:PD03<1><default><default><default>
gpio_pin_77 = port:PD04<1><default><default><default>
gpio_pin_78 = port:PD05<1><default><default><default>
gpio_pin_79 = port:PD06<1><default><default><default>
gpio_pin_80 = port:PD07<1><default><default><default>
gpio_pin_81 = port:PD08<1><default><default><default>
gpio_pin_82 = port:PD09<1><default><default><default>
gpio_pin_83 = port:PD10<1><default><default><default>
gpio_pin_84 = port:PD11<1><default><default><default>
gpio_pin_85 = port:PD12<1><default><default><default>
gpio_pin_86 = port:PD13<1><default><default><default>
gpio_pin_87 = port:PD14<1><default><default><default>
gpio_pin_88 = port:PD15<1><default><default><default>

 

 

Thanks,

Sty

Share this post


Link to post
Share on other sites
Want Armbian t-shirt or a cup?

Some future more information, my board is an Orange PI mini A20.

 

I tried to use the formla by xunxi :

(position of letter in alphabet - 1) * 32 + pin number

 

But all the numbers are over 88 and i'm not able to export them at all.

 

I try to calculate out 

gpio_pin_16 = port:PH01 but i don't really know it this port 1 or port 16 or none of them. 

it was (8 - 1) * 32 + 1 which is 225 but there are no 225 the max is 88

 

If anyone can help i would thanks that.

 

Regards,

Spot

 

Share this post


Link to post
Share on other sites

From where this 88 number comes from ?

 

Did you tried to do the following commands directly into a shell ?

 

echo 225 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio225/direction
echo 1 > /sys/class/gpio/gpio225/value

 

Share this post


Link to post
Share on other sites

Hello,

 

From the script.bin file(linked in the first post)

 

[gpio_para]
gpio_used = 1
gpio_num = 88

 

Yes, i tried and i got error because there are only 88 ports declared into the script.bin file.

 

Regards,

Sp0T

Share this post


Link to post
Share on other sites

Ok ! but thing 88 means the count of gpio definition lines, not the gpio number. This means, like you've shown in your first post, gpio_pin_1 to gpio_pin_88.

 

Did you try the commands I've provided above ?

 

 

Share this post


Link to post
Share on other sites

The result:

 

root@orange:~# echo 225 > /sys/class/gpio/export
-bash: echo: write error: Invalid argument
root@orange:~#

Share this post


Link to post
Share on other sites

I'm not using Legacy, but always Mainline, so my previous post was wrong.

 

Zador was right, Legacy image still using the old numbering scheme.

 

So the commands would be more likely be for PH1 :

echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16_ph1/direction
echo 1 > /sys/class/gpio/gpio16_ph1/value

 

Share this post


Link to post
Share on other sites

This one worked:

 

echo 16 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio16/direction
echo 1 > /sys/class/gpio/gpio16/value

 

But i still don't know which physical port is this?

Share this post


Link to post
Share on other sites

So gpio_pin_10 = port:PI12 is physically the 12nd pin on the header?

Share this post


Link to post
Share on other sites

Thank you everyone. Based on your hints, i was able to controll a port. And at last i understand it :D

 

Thank you,

Sp0T

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
0