Does the SPICmnd work this way

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
rich
Posts: 81
Joined: 19 November 2015, 12:23 PM

Does the SPICmnd work this way

Post by rich »

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
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Does the SPICmnd work this way

Post by dkinzer »

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.
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.

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
rich
Posts: 81
Joined: 19 November 2015, 12:23 PM

Post by rich »

Thanks much
Will your help i am coming up to speed.

cheers,
Richard
Post Reply