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/11/07 05:07]
nick [Enable SPI]
products:sbc:common:applications:gpio:spi [2025/02/17 21:40] (current)
nick [Enable SPI]
Line 3: Line 3:
  
 |            SPI    ^ Pin  ^ Pin name      GPIO name  ^  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    |  spi1              /dev/spidev1.1  |+^  VIM3/3L  |  SPI_B  |  15  | SPIB_SS      |  GPIOH_6    |  spi1              /dev/spidev2.1  |
 | :::       | :::      16  | SPIB_SCLK    |  GPIOH_7    | :::               | :::              | | :::       | :::      16  | SPIB_SCLK    |  GPIOH_7    | :::               | :::              |
 | :::       | :::      35  | SPIB_MISO    |  GPIOH_5    | :::               | :::              | | :::       | :::      35  | SPIB_MISO    |  GPIOH_5    | :::               | :::              |
Line 47: Line 47:
  
  
-e.g. Enable ''SPI_A'', you need to add ''spi0'' to node ''fdt_overlays'' 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 ```shell
-fdt_overlays=spi0 +fdt_overlays=spi1
 ``` ```
  
 After reboot, you will see the SPI device node. After reboot, you will see the SPI device node.
 +
 +```shell
 +$ ls /dev/spidev2.1 
 +/dev/spidev2.1
 +```
  
 <tabbox VIM3L with 5.15 kernel> <tabbox VIM3L with 5.15 kernel>
Line 61: Line 65:
  
  
-e.g. Enable ''SPI_A'', you need to add ''spi0'' to node ''fdt_overlays'' 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 ```shell
-fdt_overlays=spi0+fdt_overlays=spi1
  
 ``` ```
  
 After reboot, you will see the SPI device node. After reboot, you will see the SPI device node.
 +
 +```shell
 +$ ls /dev/spidev2.1 
 +/dev/spidev2.1
 +```
  
 <tabbox VIM4> <tabbox VIM4>
Line 613: Line 622:
  
 Connect PIN36(MOSI), PIN37(MISO) then run ''spidev_test'': Connect PIN36(MOSI), PIN37(MISO) then run ''spidev_test'':
 +
 +
  
 ```shell ```shell
-$ ./spidev_test -i spi_in.txt -o ./spi_out.txt+$ ./spidev_test -D /dev/spidev1.1 -i spi_in.txt -o ./spi_out.txt
 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.
 +</WRAP>
 +
  
 Check output data: Check output data:
Last modified: 2023/11/07 05:07 by nick