Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:common:applications:gpio:spi

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:common:applications:gpio:spi [2023/02/17 11:00]
hyphop
products:sbc:common:applications:gpio:spi [2023/11/07 05:07] (current)
nick [Enable SPI]
Line 2: Line 2:
 ===== SPI Reference table ===== ===== SPI Reference table =====
  
-|            SPI    ^ Pin  ^ Pin name      GPIO name   GPIO num   DT overlay node  ^  Device node     ^ +|            SPI    ^ Pin  ^ Pin name      GPIO name  ^  DT overlay node  ^  Device node     ^ 
-^  VIM3/3L  |  SPI_B  |  15  | SPIB_SS      |  GPIOH_6    |  433       |  spi1              /dev/spidev1.1 +^  VIM3/3L  |  SPI_B  |  15  | SPIB_SS      |  GPIOH_6    |  spi1              /dev/spidev1.1 
-| :::       | :::      16  | SPIB_SCLK    |  GPIOH_7    |  434       | :::               | :::              | +| :::       | :::      16  | SPIB_SCLK    |  GPIOH_7    | :::               | :::              | 
-| :::       | :::      35  | SPIB_MISO    |  GPIOH_5    |  432       | :::               | :::              | +| :::       | :::      35  | SPIB_MISO    |  GPIOH_5    | :::               | :::              | 
-| :::       | :::      37  | SPIB_MOSI    |  GPIOH_4    |  431       | :::               | :::              | +| :::       | :::      37  | SPIB_MOSI    |  GPIOH_4    | :::               | :::              | 
-^  VIM4      SPI_A  |  25  |  SPI_A_SCLK  |  GPIOT_20   |  466       |  spi0              /dev/spidev1.0 +^  VIM4      SPI_A  |  25  |  SPI_A_SCLK  |  GPIOT_20    spi0              /dev/spidev1.0 
-| :::       | :::      26  |  SPI_A_SS0    GPIOT_21   |  467       | :::               | :::              | +| :::       | :::      26  |  SPI_A_SS0    GPIOT_21   | :::               | :::              | 
-| :::       | :::      36  |  SPI_A_MOSI  |  GPIOT_18   |  464       | :::               | :::              | +| :::       | :::      36  |  SPI_A_MOSI  |  GPIOT_18   | :::               | :::              | 
-| :::       | :::      37  |  SPI_A_MISO  |  GPIOT_19   |  465       | :::               | :::              | +| :::       | :::      37  |  SPI_A_MISO  |  GPIOT_19   | :::               | :::              | 
-^  VIM1S    |  SPI_A  |  29  |  SPI_A_MOSI  |  GPIOZ_1    |  499       | :::               | :::              | +^  VIM1S    |  SPI_A  |  29  |  SPI_A_MOSI  |  GPIOZ_1    | :::               | :::              | 
-| :::        :::    |  31  |  SPI_A_CLK    GPIOZ_2    |  500       | :::               | :::              | +| :::       | :::     |  31  |  SPI_A_CLK    GPIOZ_2    | :::               | :::              | 
-| :::        :::    |  32  |  SPI_A_MISO  |  GPIOZ_0    |  498       | :::               | :::              | +| :::       | :::     |  32  |  SPI_A_MISO  |  GPIOZ_0    | :::               | :::              | 
-| :::        :::    |  33  |  SPI_A_SS0    GPIOZ_3    |  501       | :::               | :::              |+| :::       | :::     |  33  |  SPI_A_SS0    GPIOZ_3    | :::               | :::              |
  
 ===== Enable SPI ===== ===== Enable SPI =====
Line 41: Line 41:
 /dev/spidev1.1 /dev/spidev1.1
 ``` ```
 +
 +<tabbox VIM3 with 5.15 kernel>
 +
 +Edit ''/boot/dtb/amlogic/kvim3.dtb.overlay.env'' to add spi node to ''fdt_overlays'' node if it doesn't exist.
 +
 +
 +e.g. Enable ''SPI_B'', you need to add ''spi1'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=spi1
 +
 +```
 +
 +After reboot, you will see the SPI device node.
 +
 +<tabbox VIM3L with 5.15 kernel>
 +
 +Edit ''/boot/dtb/amlogic/kvim3l.dtb.overlay.env'' to add spi node to ''fdt_overlays'' node if it doesn't exist.
 +
 +
 +e.g. Enable ''SPI_B'', you need to add ''spi1'' to node ''fdt_overlays'' if it doesn't exist.
 +
 +```shell
 +fdt_overlays=spi1
 +
 +```
 +
 +After reboot, you will see the SPI device node.
  
 <tabbox VIM4> <tabbox VIM4>
Line 121: Line 149:
 } }
  
-static const char *device = "/dev/spidev1.1";+static const char *device = "/dev/spidev1.0";
 static uint32_t mode; static uint32_t mode;
 static uint8_t bits = 8; static uint8_t bits = 8;
Line 584: Line 612:
 ``` ```
  
-Run ''spidev_test'':+Connect PIN36(MOSI), PIN37(MISO) then run ''spidev_test'':
  
 ```shell ```shell
Last modified: 2023/02/17 11:00 by hyphop