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:spi [2023/02/14 07:17] hyphop [Introduction] |
products:sbc:common:applications:gpio:spi [2026/09/15 03:26] (current) nick |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== SPI ====== | ||
| - | ===== Introduction ===== | ||
| - | SPI interface usage example [[/ | + | ===== SPI Reference table ===== |
| - | + | | | |
| - | ===== Reference table ===== | + | ^ VIM3/ |
| - | + | | ::: | ::: | |
| - | | | + | | ::: | ::: |
| - | ^ VIM3/ | + | | ::: | ::: |
| - | | ::: | ::: | + | ^ VIM4 |
| - | | ::: | ::: | + | | ::: | ::: |
| - | | ::: | ::: | + | | ::: | ::: |
| - | ^ VIM4 | + | | ::: | ::: |
| - | | ::: | ::: | + | ^ VIM1S | SPI_A | 29 | SPI_A_MOSI |
| - | | ::: | ::: | + | | ::: | ::: |
| - | | ::: | ::: | + | | ::: | ::: |
| - | ^ VIM1S | SPI_A | 29 | SPI_A_MOSI | + | | ::: | ::: |
| - | | ::: | + | ^ VIM-5 | SPI_C | 26 | SPI_C_MOSI |
| - | | ::: | + | | ::: |
| - | | ::: | + | | ::: | ::: |
| + | | ::: | ::: | ||
| ===== Enable SPI ===== | ===== Enable SPI ===== | ||
| Line 45: | Line 44: | ||
| $ ls / | $ ls / | ||
| / | / | ||
| + | ``` | ||
| + | |||
| + | <tabbox VIM3 with 5.15 kernel> | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | |||
| + | e.g. Enable '' | ||
| + | |||
| + | ```shell | ||
| + | fdt_overlays=spi1 | ||
| + | ``` | ||
| + | |||
| + | After reboot, you will see the SPI device node. | ||
| + | |||
| + | ```shell | ||
| + | $ ls / | ||
| + | / | ||
| + | ``` | ||
| + | |||
| + | <tabbox VIM3L with 5.15 kernel> | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | |||
| + | e.g. Enable '' | ||
| + | |||
| + | ```shell | ||
| + | fdt_overlays=spi1 | ||
| + | |||
| + | ``` | ||
| + | |||
| + | After reboot, you will see the SPI device node. | ||
| + | |||
| + | ```shell | ||
| + | $ ls / | ||
| + | / | ||
| ``` | ``` | ||
| Line 74: | Line 110: | ||
| ```shell | ```shell | ||
| fdt_overlays=spi0 | fdt_overlays=spi0 | ||
| + | |||
| + | ``` | ||
| + | |||
| + | After reboot, you will see the SPI device node. | ||
| + | |||
| + | ```shell | ||
| + | $ ls / | ||
| + | / | ||
| + | ``` | ||
| + | |||
| + | <tabbox VIM-5> | ||
| + | |||
| + | Edit ''/ | ||
| + | |||
| + | |||
| + | e.g. Enable '' | ||
| + | |||
| + | ```shell | ||
| + | fdt_overlays=spi1 | ||
| ``` | ``` | ||
| Line 126: | Line 181: | ||
| } | } | ||
| - | static const char *device = "/ | + | static const char *device = "/ |
| static uint32_t mode; | static uint32_t mode; | ||
| static uint8_t bits = 8; | static uint8_t bits = 8; | ||
| Line 589: | Line 644: | ||
| ``` | ``` | ||
| - | Run '' | + | Connect PIN36(MOSI), |
| + | |||
| ```shell | ```shell | ||
| - | $ ./ | + | $ ./ |
| spi mode: 0x0 | spi mode: 0x0 | ||
| bits per word: 8 | bits per word: 8 | ||
| max speed: 500000 Hz (500 KHz) | max speed: 500000 Hz (500 KHz) | ||
| ``` | ``` | ||
| + | |||
| + | <WRAP important > | ||
| + | Please choose the correct spi device node. | ||
| + | </ | ||
| + | |||
| Check output data: | Check output data: | ||