Hi, I followed the SPI tutorial on http://members.cox.net/ebrombaugh1/embedded/mini2440/index.html. SPI works with ioctl(). However, when I tried write() and read() functions, this does not work with loopback? I used the code found here http://www.armbedded.eu/node/318. Is this because read and write function is for half duplex so it does not work with loopback? Thanks in advance
SPI loopback problem
From Wilipedia: During each SPI clock cycle, a full duplex data transmission occurs: * the master sends a bit on the MOSI line; the slave reads it from that same line * the slave sends a bit on the MISO line; the master reads it from that same line You are controlling the slave select line? Quote from your article: There are two ways of of using the user mode spi device driver. You can call either the read/write functions or an ioctl(). With calling read/write you can only read or write at a (one) time. If you need full-duplex read and write, you have to call the (use the example using) ioctl's. Why do you need "loopback"? To confirm the data sent to the slave?
Yes, as a test to see if the SPI port works. is there no way to test the SPI with the read() and write() function?
Maybe ask a slave device, ie an ADC, to return a conversion value. They usually take say 10-100us to do a conversion. I am guessing your read and write calls don't take that long. Most of my experience is on the AVR ATmega series with no OS getting in the way. Good luck.
The spidev_test in the link http://members.cox.net/ebrombaugh1/embedded/mini2440/index.html worked fine for me when loopbacked. Are you missing something in the board file? can you post the changes in your board file?