Toybrick EN

中文 / EN
Toybrick EN Wiki TB-96AI How to attach a SPI device to board
How to attach a SPI device to board

Enable the SPI device in device tree

  1. &spi5 {
        status = "okay";
        max-freq = <48000000>;   //spi internal clk, don't modify
        spi_test@00 {
               compatible = "rockchip,spi_test_bus0_cs0";
               reg = <0>;   //chip select  0:cs0  1:cs1
               id = <0>;
               spi-max-frequency = <24000000>;   //spi output clock
        spi_test@01 {
               compatible = "rockchip,spi_test_bus0_cs1";
               reg = <1>;
               id = <1>;
               spi-max-frequency = <24000000>;

max-freq: We only support the max 48000000HZ, a large value would result in error.

spi_test@00: Which CS pin is used for this device, it would be the same value for the index of CS pin and reg value.

compatible: The device driver of the SPI device, the string here should match its driver

id: When you have multiple same devices here, you should assign an unique id for each of them.

spi-max-frequency: The max frequency for this device;

You can find a sample code for the SPI device here:


Products Store Community Wiki Download About TB

To Top