[#4945] verify spidev works with multiple devices/cs
Submitted By: Mike Frysinger
Open Date
2009-02-26 13:36:42 Close Date
2009-12-04 01:07:49
Priority:
Medium Assignee:
Yi Li
Status:
Closed Fixed In Release:
N/A
Found In Release:
snaps Release:
Category:
Drivers Board:
STAMP
Processor:
ALL Silicon Revision:
Is this bug repeatable?:
Yes Resolution:
Out of Date
Uboot version or rev.:
Toolchain version or rev.:
trunk
App binary format:
N/A
Summary: verify spidev works with multiple devices/cs
Details:
there is a report here:
blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&_forum_action=MessageReply&message_id=70026
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...)
Follow-ups
--- 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
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
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
/dev/spidev0.5
". 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:
Index: Documentation/spi/spidev_test.c
===================================================================
--- 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 fd;
+ int i = 0;
parse_opts(argc, argv);
@@ -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);
- transfer(fd);
+ for (i = 0; i < 1024; i++)
+ transfer(fd);
close(fd);
Then run:
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
spidev2.png.
--- 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 ...
Files
Changes
Commits
Dependencies
Duplicates
Associations
Tags
File Name File Type File Size Posted By
spidev.png image/png 16583 Yi Li
spidev2.png image/png 18578 Yi Li