On Monday 10 March 2008, Joakim Tjernlund wrote:
> Trying to make sense of spidev. We have 5 spi devices on the
> same spi bus and I am trying to use different word sizes for some of the
> devices.
>
> I open 5 diffrent /dev/spidev0.x where x=0..4 and for
> each fd returned I do:
> ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
That is, something like:
fd[x] = open("/dev/spidev0.x", O_RDWR);
ioctl(fd[x], SPI_IOC_WR_BITS_PER_WORD, &bits[x]);
Each device should have its own file descriptor.
> bits is either 8 or 16.
> However, it seems that the last ioctl "wins", all spi transactions
> appears to used the last setting, thats is, the ioctl appears to be
> for the controller, not the spi slave I am talking to.
Sounds like a bug in the controller driver, if you're properly
getting a file descriptor per device...
> This does not make sense to me, I figured I could set bits_per_word(and
> max speed too) for each slave. Can anyone tell me how spidev is supposed
> to work? It is quite possible that I got a problem in spi HW driver that
> fools me somehow.
Absolutely. Each device has a variety of individual characteristics,
like speed, bits per word, mode, and so on. That's why they're stored
in the spi_device rather than the controller
- Dave
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
spi-devel-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spi-devel-general