[#4945] verify spidev works with multiple devices/cs
Submitted By: Mike Frysinger
2009-02-26 13:36:42 Close Date
Closed Fixed In Release:
Found In Release:
ALL Silicon Revision:
Is this bug repeatable?:
Out of Date
Uboot version or rev.:
Toolchain version or rev.:
App binary format:
Summary: verify spidev works with multiple devices/cs
there is a report here:
attempting to use spidev with cs 1 and cs 5 results in only one working
we need to verify that writing to one at a time works and that writing to both works (in other words, write a few bytes to cs1, then a few to cs5, then a few to cs1, etc...)
--- Yi Li 2009-03-27 04:57:46
Do we need to connect real spi devices to reproduce?
If yes, we do not have proper hardware to connect multiple spi devices on a spi
bus. I used to use BF537-STAMP + spi-mmc + ad1836 to test multiple devices. But
this is not enough for this case.
--- Mike Frysinger 2009-03-27 12:19:56
the ad1836 only uses SPI for register setup i thought, not normal playing. so
unless your test was more about constantly changing mixer settings than playing
audio, that test might not be so useful.
however, since SPI can be wiggled by the master only without any slave devices
hooked up, i would put a scope on the CS pins and write a test app that simply
writes bytes back and worth between multiple spidev's and make sure that the
CS's do not mix.
--- Yi Li 2009-04-14 03:34:32
This bug does not exist in svn trunk. I tested using svn-6626 linux-kernel,
using the "spidev_test" program, on BF537-STAMP.
I connect SPI_SSEL1 and SPI_SSEL5 to scope. When running:
root:/> spidev_test -D /dev/spidev0.5
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
FF FF FF FF FF FF
Only SPI_SSEL5 pulls down. And when running:
root:/> spidev_test -D /dev/spidev0.1
Only SPI_SSEL1 pulls down.
The CS work as expected.
--- Mike Frysinger 2009-04-14 03:43:02
and it works if you run them at the same time ?
spidev_test -D /dev/spidev0.5 &
spidev_test -D /dev/spidev0.1 &
--- Yi Li 2009-04-14 03:48:14
Attached the scope image when running "root:/> spidev_test -D
". ch1 is spi_sck, ch2 is spi_sse11, ch3 is spi_ssel5.
--- Yi Li 2009-04-14 05:49:12
I modified spitest.c as this:
--- Documentation/spi/spidev_test.c (revision 6266)
+++ Documentation/spi/spidev_test.c (working copy)
@@ -150,6 +150,7 @@ int main(int argc, char *argv)
int ret = 0;
+ int i = 0;
@@ -194,7 +195,8 @@ int main(int argc, char *argv)
printf("bits per word: %d\n", bits);
printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000);
+ for (i = 0; i < 1024; i++)
spidev_test -D /dev/spidev0.1 > /dev/null &
spidev_test -D /dev/spidev0.5 > /dev/null
It works as expected (as far as I can see fromt the scope). see attached
--- Yi Li 2009-04-14 05:52:45
Comparing spidev.png and spidev2.png, Ch2 is a little different. I am not clear
about the reason.
--- Mike Frysinger 2009-04-14 06:21:17
is it floating ? if it floats too high, that'd be the same thing as asserting
the CS ...
File Name File Type File Size Posted By
spidev.png image/png 16583 Yi Li
spidev2.png image/png 18578 Yi Li