This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
products:sbc:common:applications:gpio:40pin-header [2022/10/17 00:14] hyphop [Boards reference table] |
products:sbc:common:applications:gpio:40pin-header [2023/08/16 06:31] jacobe [Set GPIO value] |
||
---|---|---|---|
Line 3: | Line 3: | ||
====== GPIO Header ====== | ====== GPIO Header ====== | ||
- | Universal GPIO 40 pins board header, provided for wide range communication... | + | ===== GPIO usage examples |
- | + | ||
- | ===== Boards reference table | + | |
<WRAP important > | <WRAP important > | ||
- | Current GPIO numbers valid for vendor kernel only. Mainline linux kernel GPIO numbers will be different... | + | Please make sure that the GPIOs you want to use are not configured as other functions, if they are, you can follow [[products: |
</ | </ | ||
- | ==== VIM1 ==== | + | When you get the GPIO number, you can follow the steps below to control it. Here we take GPIO number '' |
- | ^ GPIO | + | ==== Export |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | | + | |
- | | | + | |
- | | 506 | PIN.AO5 | 15 | + | |
- | | 505 | PIN.AO4 | 16 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | ==== VIM2 ==== | + | ```shell |
+ | $ echo 111 | sudo tee / | ||
+ | ``` | ||
- | ^ GPIO ^ Name ^ Physical | + | ==== Set-up |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 470 | PIN.DV21 | + | |
- | | 471 | PIN.DV22 | + | |
- | | 472 | PIN.DV23 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | PIN.H4 | + | |
- | | | + | |
- | | 506 | PIN.AO5 | + | |
- | | 505 | PIN.AO4 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | ==== VIM3 VIM3L ==== | + | We can configure direction as input or output. |
- | ^ GPIO ^ Name ^ Physical | + | ```shell |
- | | | 5V | 1 | 21 | + | $ echo out | sudo tee / |
- | | | + | $ echo in |
- | | | + | ``` |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 506 | PIN.AO10 | + | |
- | | | + | |
- | | 433 | PIN.H6 | + | |
- | | 434 | PIN.H7 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | ==== VIM4 ==== | + | ==== Set GPIO value ==== |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 420 | SPDIFOUT | + | |
- | | | + | |
- | | 491 | PIN.Y7 | + | |
- | | 490 | PIN.Y6 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | + | ||
- | ==== VIM1S ==== | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | 5V | | + | |
- | | | 5V | | + | |
- | | | USB_DM | + | |
- | | | USB_DP | + | |
- | | | | + | |
- | | | VCCMCU | + | |
- | | | MCU_NRST | + | |
- | | | MCU_SWIM | + | |
- | | | | + | |
- | | | | + | |
- | | | VDD1V8 | + | |
- | | | | + | |
- | | | + | |
- | | | | + | |
- | | | + | |
- | | | + | |
- | | | | + | |
- | | | PIN.D1 | + | |
- | | | PIN.D0 | + | |
- | | | | + | |
- | + | ||
- | ==== Edge-V ==== | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 112 | SPDIF/ | + | |
- | | | + | |
- | | 50 | + | |
- | | 49 | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | ==== Edge2 ==== | + | |
- | + | ||
- | ^ GPIO ^ Name ^ Physical | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | 112 | SPI1_MOSI_M1/ | + | |
- | | 111 | SPI1_MISO_M1/ | + | |
- | | 114 | SPI1_CS_M1/ | + | |
- | | 113 | SPI1_CLK_M1/ | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | | | + | |
- | + | ||
- | + | ||
- | ===== Control GPIO ===== | + | |
- | + | ||
- | <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: | + | |
- | </ | + | |
- | + | ||
- | When you get the GPIO number, you can follow the steps below to control it. Here we take GPIO number '' | + | |
- | + | ||
- | **Export GPIO:** | + | |
```shell | ```shell | ||
- | $ echo 465 | sudo tee / | + | $ echo 1 | sudo tee / |
+ | $ echo 0 | sudo tee / | ||
``` | ``` | ||
- | **Set GPIO direction: | + | ==== Get GPIO value ==== |
- | You can set the direction input or output. | + | |
```shell | ```shell | ||
- | $ echo out | sudo tee / | + | $ cat / |
- | $ echo in | sudo tee / | + | |
``` | ``` | ||
- | **Set or get GPIO value:** | + | ==== Unexport |
- | ```shell | + | |
- | $ echo 1 | sudo tee / | + | |
- | $ echo 0 | sudo tee / | + | |
- | $ cat / | + | |
- | ``` | + | |
- | **Unexport GPIO:** | ||
```shell | ```shell | ||
- | $ echo 465 | sudo tee / | + | $ echo 111 | sudo tee / |
``` | ``` | ||
- | ===== Troubleshooting | + | ==== 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: | 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 | ```shell | ||
- | khadas@Khadas: | + | khadas@Khadas: |
tee: / | tee: / | ||
``` | ``` | ||