ROCKPI S Enable SPI1 and SPI2 at the same time

Hi,
I need to access two different devices on SPI bus. They are operating on two different SPI modes and hence can’t hook to the same bus. So how can I enable both SPI 1 and SPI2 at the same time?

Thanks

@Mitchell Please help to fix the issue.

Hi @ThusithaSKS, May I ask what version of software you are using?

Hi, I’m referring to https://wiki.radxa.com/RockpiS/Ubuntu. As per that I can configure only one SPI at a time.
overlays=rk3308-spi-spidev
param_spidev_spi_bus=2
param_spidev_spi_cs=0
param_spidev_max_freq=10000000

How can I configure second SPI?

Thanks

Is this the image you are using?
rockpis_ubuntu_focal_server_arm64_20210924_0418-gpt.img.gz

Unzip this package, you will get two files: rk3308-spi1-spidev.dtbo , rk3308-spi2-spidev.dtbo

Then copy these two files to the /boot/dtbs/4.4.143-65-rockchip-g58431d38f8f3/rockchip/overlay/ directory of the board.

After that, you just need to add rk3308-spi1-spidev rk3308-spi2-spidev after the overlay line in the /boot/uEnv.txt file, and that’s it, enough for reboot, you will see spidev1.0 and spidev2.0 in the /dev directory.

overlays=rk3308-uart0 rk3308-spi1-spidev rk3308-spi2-spidev

spi_dtbo.zip (1.1 KB)

Hi Mitchell,

It worked and spidev1.0 and spidev2.0 devices are connected. But when I try to open a SPI device using libmraa, it fails to initialize SPI device. (I’m trying example on https://wiki.radxa.com/RockpiS/dev/libmraa)

Thanks

Hi,

I tried to enable SPI devices one by one. SPI 1 initializes as per libmraa example. But SPI 2 fails to initialize. Pls help

ROCKPI S Ver 13
OS rockpis_ubuntu_focal_server_arm64_20210924_0418-gpt.img.gz

Thanks

Hi,

I had the problem of initializing SPI2 using mraa_spi_init() function. It was solved by using mraa_spi_init_raw() function.

Thanks