If the SPICmd has a write count and a read count, from the system reference manual, is this how it works:
The write count data is sent out on MOSI.
Then the read count data is output on byte at a time and the input on MISO read and stored in the read data variable.
If this is not true then i looks to me that if a read is done write count needs to be zero since the read operation writes read data and then read MISO data and puts in the read data variable.
richard
Does the SPICmnd work this way
Re: Does the SPICmnd work this way
Yes, that is how it works. It is designed this way so that if, for a particular application, one or more bytes of data need to be written before beginning the read operation those bytes can be put in the writeData array.rich wrote:If this is not true then i looks to me that if a read is done write count needs to be zero since the read operation writes read data and then read MISO data and puts in the read data variable.
You could accomplish the same thing, I suppose, by putting the bytes to be written in the first N bytes of the readData array and then just skipping over the first N bytes when processing the received data.
If you don't have any data that needs to be written first just set writeCnt to zero.
- Don Kinzer