Easier way to enable SPI on DB410c Debian?

Hello,

I’ve seen from a previous post that it is possible to get SPI working on the Dragonboard 410c.
However this seems like a lot of work just to enable something that the spec says should be on the 40 Pin Low Speed Expansion Connector anyway.

Are there plans to have SPI on by default as per the spec? Or at least an easier way to switch SPI on?

Thanks,
Barry

Hi @barryb,

Yes, it is pain that SPI is not working as a default on DragenBoard 410C.

We are planning to enable SPI in the next release but I do not have the concrete detail information yet.
I will write on the forum when I have the information.

Things have improved some and the SPIDEV bits are now included in the image. Here is a howto to get this going.

the “howto” link is broken. Do you have an updated one ?
Looking for the easiest way to enable SPI on DB410c.

Hi @Luis_Sanchez,

Here is the link to the SPI guide for Dragonboard410c:

https://github.com/96boards/documentation/blob/master/consumer/dragonboard410c/guides/enable-spi.md

Thanks,
Mani

Thanks Mani. Excuse, from this webpage, I find two different options to download the image, one is to install to emmc and the other is to run from SD card. Which should I use if I want to enable the SPI bus per these instructions, thanks.

Hi @Luis_Sanchez,

The documentation page doesn’t list eMMC or SD boot, what ‘webpage’ you are referring to? Anyway, since the instructons specify using dt-update tool for modifying the kernel image, you have to use eMMC boot.

Thanks,
Mani

dt-update doesn’t really mind whether you are running from eMMC or SD card. However when you boot from SD card then there can be two partitions called boot (one on eMMC and one on SD card) meaning the default install location /dev/disk/by-partlabel/boot becomes problematic (how do you know whether it points at the eMMC boot image of the SD card boot image).

If you really want to work from SD card then its something we could solve… but if you don’t care then just run from eMMC… its faster anyway.

Thanks Mani and Daniel.

Hi @Mani,
I have followed the instructions and was able to execute the dt-update and then I did get the spidev_test app but when running it it doesn’t echo the bytes being sent,

The next is the snippet of what I see:

root@linaro-alip:~# sudo ./spidev_test -CHO -D /dev/spidev0.0 0xaa --loop
spi mode: 0x27
bits per word: 8
max speed: 500000 Hz (500 KHz)

I do an lsmod and it appears the spidev driver is running.
root@linaro-alip:~# lsmod | grep spi
spidev 20480 0

Am I missing something? Thanks in advanced for your help.
Regards,
Luis.

Hi @Luis_Sanchez,

Looks like the instruction for testing SPIDEV using spidev_test utility is messed up! You should be able to test it using the below instructions:

TX/RX with Loopback

$ sudo ./spidev_test -CHOv -D /dev/spidev0.0  -loop
spi mode: 0x27
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
RX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.

TX/RX with without Loopback

When you don’t pass -loop argument, you can see only FF in the Received data.

$ sudo ./spidev_test -CHOv -D /dev/spidev0.0
spi mode: 0x7
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | FF FF FF FF FF FF 40 00 00 00 00 95 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF F0 0D  | ......@....�..................�.
RX | FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  | ................................

Will change the instructions accordingly!

Thanks,
Mani

Hi @Mani,
Thanks, it worked now!
Excuse me, I see I can send the contents of a file but, is there a way to just send some bytes as Command line arguments? i didn’t see that in the source code of spidev_test.c app.

Thanks again,
Luis.

Excuse me, I see I can send the contents of a file but, is there a way to just send some bytes as Command line arguments? i didn’t see that in the source code of spidev_test.c app.

Yes, you can use -p switch for sending the bytes from command line as below:

linaro@linaro-alip:~$ sudo ./spidev_test -CHOv -D /dev/spidev0.0 -loop -p "0x11 0x00 0xFF"
spi mode: 0x27
bits per word: 8
max speed: 500000 Hz (500 KHz)
TX | 30 78 31 31 20 30 78 30 30 20 30 78 46 46 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  | 0x11.0x00.0xFF
RX | 30 78 31 31 20 30 78 30 30 20 30 78 46 46 __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __  | 0x11.0x00.0xFF

-Mani

@Mani,

Thanks very much!

Regards,
Luis.