Main Site Documentation

SPI Question


#1

I noticed that the SPI class has a Write method and a WriteRead method.

If a delay is required after the Write before the Read is there a way to accomplish this? Or does the SPI interface have intelligence to support asyncronously waiting for data to be returned from the SPI device??

Thanks…


#2

The way SPI works, it swaps the data between 2 sides so a write will always result in read and this is how WriteRead method works. The Write method simply ignores the data coming back from the device.

See here under operation http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus

Now, if you are writing to a device with BUSY pin, we support that…if you are writing to a device that requires a write then a read with some delay in between then just divide your code to do 2 SPI transfers and add a delay in between…I never seen a case where you need to do this though!


#3

How is the BUSY pin detected as you mention for the SPI Read?

Thanks,
Tony


#4

In the SPI configuration there is an option to set the a pin to be the BUSY pin and then set the “busy state” to high or low.