[meta-xilinx] SPI problem
Moritz Fischer
moritz.fischer at ettus.com
Thu May 11 09:26:39 PDT 2017
Hi Arno,
On Tue, May 9, 2017 at 5:54 AM, Arno Steffens <star at gmx.li> wrote:
> I have a rather strange SPI protocol to run: write and read use different edges to sample.
> See image:
>
> I configured the spi like that:
>
> static u8 mode_wr = 0;
> static u8 mode_rd = 1;
>
> ret = ioctl(file_spi0, SPI_IOC_WR_MODE, &mode_wr);
> if (ret == -1)
> printf("can't set spi mode");
>
> ret = ioctl(file_spi0, SPI_IOC_RD_MODE, &mode_rd);
> if (ret == -1)
> printf("can't get spi mode");
>
>
> The transfer itself runs via:
>
> ret = ioctl(file_spi0, SPI_IOC_MESSAGE(1), &transfer);
>
> But it seems, that only SPI_IOC_WR_MODE has an effect for both, write and read.
> Is this a limitation of hardware, bug in driver or my bug?
I think the SPI_IOC_RD_MODE ioctl is not doing what you think it is
doing. It lets you read back the
current spi mode, not set the read mode.
http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/spi/spidev.h#L120
Thanks,
Moritz
More information about the meta-xilinx
mailing list