Spidev do not write/read simultaneously using ioctl

徘徊边缘 提交于 2019-12-04 03:47:19

Well, the post is quiet overwhelming. I just read a few parts and recently got in touch with SPI on Linux. However, as mentioned in https://www.kernel.org/doc/Documentation/spi/spidev async read/write is not available in userspace. AFAIK read/write is just a wrapper around fcntl. Thus you'll need to write your own kernel module to achieve async I/O.

I know this is a very old thread but I've been using spidev on the RT5350 running OpenWRT. I'm getting exactly the same results as you; I'm just not able to get a full duplex transfer happening. Reading the RT5350 datasheet it appears that the hardware is only able to do half duplex SPI transfers. Each transfer is either a write (output bytes on MOSI, don't read anything), or a read (output zeros on MOSI, read MISO).

I can't get the datasheet for your P1021 chip, but considering the similarity of our results I'd say its hardware SPI is implemented in a similar way.

This means that a kernel module isn't the answer (ioctl SPI_IOC_MESSAGE eventually calls spi_async() anyway). The only way to do full duplex SPI is using GPIOs in software.

RT5350 reference: http://forum.vocore.io/viewtopic.php?f=3&t=72#p233

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!