This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
products:sbc:common:applications:gpio:40pin-header [2022/10/14 07:01] haylrn [Introduction] |
products:sbc:common:applications:gpio:40pin-header [2024/08/12 03:08] (current) william [Troubleshooting] |
||
---|---|---|---|
Line 1: | Line 1: | ||
{{indexmenu_n> | {{indexmenu_n> | ||
- | ====== | + | ====== |
- | <WRAP important > | + | ====== GPIO usage examples |
- | This guide are only suitable for vendor kernel. For mainline linux kernel, GPIO numbers are different. | + | |
- | </ | + | |
- | + | ||
- | ===== Introduction | + | |
- | + | ||
- | The page introduces the number values of the 24 pins on the GPIO Header and leads you to control these pins.24 | + | |
- | + | ||
- | ===== Preparation ===== | + | |
- | + | ||
- | At the beginning, you need to get the correct GPIO numbers of the GPIOs you want to use. You can get them from the table below. | + | |
- | + | ||
- | <tabbox VIM1> | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | | + | |
- | | | + | |
- | | 506 | PIN.AO5 | 15 | + | |
- | | 505 | PIN.AO4 | 16 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | <tabbox VIM2> | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 470 | PIN.DV21 | + | |
- | | 471 | PIN.DV22 | + | |
- | | 472 | PIN.DV23 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | PIN.H4 | + | |
- | | | + | |
- | | 506 | PIN.AO5 | + | |
- | | 505 | PIN.AO4 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | <tabbox VIM3/ | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 506 | PIN.AO10 | + | |
- | | | + | |
- | | 433 | PIN.H6 | + | |
- | | 434 | PIN.H7 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | <tabbox VIM4> | + | |
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | SPDIFOUT | + | |
- | | | + | |
- | | 491 | PIN.Y7 | + | |
- | | 490 | PIN.Y6 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | + | ||
- | <tabbox VIM1S> | + | |
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | 5V | | + | |
- | | | 5V | | + | |
- | | | USB_DM | + | |
- | | | USB_DP | + | |
- | | | | + | |
- | | | VCCMCU | + | |
- | | | MCU_NRST | + | |
- | | | MCU_SWIM | + | |
- | | | | + | |
- | | | | + | |
- | | | VDD1V8 | + | |
- | | | | + | |
- | | | + | |
- | | | | + | |
- | | | + | |
- | | | + | |
- | | | | + | |
- | | | PIN.D1 | + | |
- | | | PIN.D0 | + | |
- | | | | + | |
- | + | ||
- | <tabbox Edge-V> | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 112 | SPDIF/ | + | |
- | | | + | |
- | | 50 | + | |
- | | 49 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | <tabbox Edge2> | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 112 | SPI1_MOSI_M1/ | + | |
- | | 111 | SPI1_MISO_M1/ | + | |
- | | 114 | SPI1_CS_M1/ | + | |
- | | 113 | SPI1_CLK_M1/ | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ===== Control GPIO ===== | + | |
<WRAP important > | <WRAP important > | ||
Line 192: | Line 11: | ||
When you get the GPIO number, you can follow the steps below to control it. Here we take GPIO number '' | When you get the GPIO number, you can follow the steps below to control it. Here we take GPIO number '' | ||
- | **Export GPIO:** | + | ===== Export GPIO ===== |
```shell | ```shell | ||
Line 198: | Line 17: | ||
``` | ``` | ||
- | **Set GPIO direction:**\\ | + | ===== Set-up GPIO direction |
- | You can set the direction input or output. | + | |
+ | We can configure | ||
```shell | ```shell | ||
$ echo out | sudo tee / | $ echo out | sudo tee / | ||
- | $ echo in | sudo tee / | + | $ echo in | sudo tee / |
``` | ``` | ||
- | **Set or get GPIO value:** | + | ===== Set GPIO value ===== |
```shell | ```shell | ||
$ echo 1 | sudo tee / | $ echo 1 | sudo tee / | ||
$ echo 0 | sudo tee / | $ echo 0 | sudo tee / | ||
+ | ``` | ||
+ | |||
+ | ===== Get GPIO value ===== | ||
+ | |||
+ | ```shell | ||
$ cat / | $ cat / | ||
``` | ``` | ||
- | **Unexport GPIO:** | + | ===== Unexport GPIO ===== |
```shell | ```shell | ||
$ echo 465 | sudo tee / | $ echo 465 | sudo tee / | ||
Line 223: | Line 50: | ||
```shell | ```shell | ||
- | khadas@Khadas: | + | $ echo 465 | sudo tee / |
tee: / | tee: / | ||
``` | ``` | ||