|
|
(20 intermediate revisions by 7 users not shown) |
Line 1: |
Line 1: |
− | {{rockpi4_header}}
| + | #redirect [[Rock4/hardware/gpio]] |
− | {{Languages|rockpi4/hardware/gpio}}
| + | |
− | | + | |
− | [[rockpi4 | ROCK Pi 4]] > [[rockpi4/hardware | Hardware]] > [[rockpi4/hardware/gpio | GPIO]]
| + | |
− | | + | |
− | Full 40PIN GPIO pinout and numbers can be found at: https://wiki.radxa.com/Rockpi4/hardware/rockpi4#gpio
| + | |
− | | + | |
− | Rockchip RK3399 GPIO has 5 banks, GPIO0 to GPIO4, each bank has 32pins, naming as below:
| + | |
− | | + | |
− | GPIO0_A0 ~ A7
| + | |
− | GPIO0_B0 ~ B7
| + | |
− | GPIO0_C0 ~ C7
| + | |
− | GPIO0_D0 ~ D7
| + | |
− |
| + | |
− | GPIO1_A0 ~ A7
| + | |
− | ....
| + | |
− | GPIO1_D0 ~ D7
| + | |
− | | + | |
− | For Rockchip 4.4 kernel, the GPIO number can be calculated as below, take GPIO4_D5(PIN22 on 40PIN GPIO) as an example:
| + | |
− | | + | |
− | GPIO4_D5 = 32*4 + 8*3 + 5 = 157
| + | |
− | | + | |
− | To set GPIO4_D5 output
| + | |
− | | + | |
− | cd /sys/class/gpio
| + | |
− | echo 157 > export
| + | |
− | cd gpio157
| + | |
− | echo out > direction
| + | |
− | echo 1 > value # output high
| + | |
− | echo 0 > value # output low
| + | |