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/07/08 02:30] hyphop [Control GPIO] |
products:sbc:common:applications:gpio:40pin-header [2024/08/12 03:08] (current) william [Troubleshooting] |
||
---|---|---|---|
Line 1: | Line 1: | ||
{{indexmenu_n> | {{indexmenu_n> | ||
+ | ====== GPIO Header ====== | ||
- | ====== | + | ====== |
- | ===== Introduction ===== | + | <WRAP important > |
+ | Please make sure that the GPIOs you want to use are not configured as other functions, if they are, you can follow [[products: | ||
+ | </ | ||
- | This document will introduce **how to control | + | When you get the GPIO number, you can follow the steps below to control |
- | ===== Preparation ===== | + | ===== Export |
- | + | ||
- | Before controlling the GPIO, we first need to get to the number of the GPIO. Refer to the table below to find the number value of the GPIO you need to control. | + | |
- | + | ||
- | <tabbox VIM1> | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | | + | |
- | | | + | |
- | | 506 | PIN.AO5 | 15 | + | |
- | | 505 | PIN.AO4 | 16 | + | |
- | | | + | |
- | | 502 | PIN.AO1 | 18 | + | |
- | | 503 | PIN.AO2 | 19 | + | |
- | | | + | |
- | + | ||
- | <tabbox VIM2> | + | |
- | + | ||
- | ^GPIO ^Name ^Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 470 | PIN.DV21 | + | |
- | | 471 | PIN.DV22 | + | |
- | | 472 | PIN.DV23 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | PIN.H4 | + | |
- | | | + | |
- | | 506 | | + | |
- | | 505 | | + | |
- | | | + | |
- | | 502 | | + | |
- | | 501 | | + | |
- | | | + | |
- | + | ||
- | <tabbox VIM3/ | + | |
- | + | ||
- | ^GPIO ^Name ^Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 506 | PIN.AO10 | + | |
- | | | + | |
- | | 433 | PIN.H6 | + | |
- | | 434 | PIN.H7 | + | |
- | | | + | |
- | | 497 | | + | |
- | | 496 | | + | |
- | | | + | |
- | + | ||
- | <tabbox VIM4> | + | |
- | {{ : | + | |
- | ^GPIO ^Name ^Pin ^Pin ^Name ^GPIO ^ | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | SPDIFOUT | + | |
- | | | + | |
- | | 491 | PIN.Y7 | + | |
- | | 490 | PIN.Y6 | + | |
- | | | + | |
- | | 413 | PIN.D1 | + | |
- | | 414 | PIN.D2 | + | |
- | | | + | |
- | + | ||
- | <tabbox Edge1> | + | |
- | + | ||
- | ^GPIO ^Name ^Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 112 | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ===== Control GPIO ===== | + | |
- | + | ||
- | When you get the GPIO number, you can follow the steps below to control it. Here will take GPIO number '' | + | |
- | + | ||
- | **Export GPIO:** | + | |
```shell | ```shell | ||
$ echo 465 | sudo tee / | $ echo 465 | sudo tee / | ||
``` | ``` | ||
- | **Set GPIO direction:**\\ | + | |
- | You can set the direction input or output. | + | ===== Set-up GPIO direction |
+ | |||
+ | 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 / | ||
``` | ``` | ||
+ | |||
+ | ===== Troubleshooting ===== | ||
+ | |||
+ | If you got the similar error below, it means that the PIN you try to export is used for another function, you need to edit [[products: | ||
+ | |||
+ | ```shell | ||
+ | $ echo 465 | sudo tee / | ||
+ | tee: / | ||
+ | ``` | ||
+ |