2
votes

I'm trying to get second SPI channel spidev1.x by adding the code below into config.txt on Raspberry Pi 3.

dtparam=spi=on
dtoverlay=spi0-hw-cs
dtoverlay=spi1-1cs

So far I get spidev0.x under folder /dev, but not spidev1.x. The code above works on Raspbian. Is there a method to enable second SPI channel for AT?

1
Just for complete clarity, what version of the Android Things preview are you using? Is this done with DP1 or DP2?devunwired
@Devunwired It's Developer Preview 2ierturk

1 Answers

2
votes

The issue here divides into two parts:

  1. Enabling the spidev driver in the kernel.
  2. Accessing SPI1 using the SpiDevice APIs provided by Peripheral I/O.

Since you cannot see /dev/spidev1.x in the kernel, both problems are at hand.

For issue #1, there seems to be a link between the usage of UART0 and SPI1 as noted in this RPi forum post. In the latest preview of Android Things (DP2), UART0 is currently shared with the console and routed to the GPIO header pins for use by apps. It's possible that you might have to disable UART0 in order to get SPI1 to work at the kernel level.

However, regarding issue #2, the Peripheral I/O APIs do not currently expose SPI1 in Android Things DP2. So even with the kernel issue resolved there would not be a direct way to access the port from an app. We are working on ways to enable additional ports outside of those pre-defined at build time, but do not have a solution at this time.