SPI Slave problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello everyone : )

I have a problem with SPI slave in psoc creator, related to my inexperience. In my main() program, I have calculated array of 0's and 1's, and I need to SPI it out     (communication controlled by external clock bursts LGC-clk).

I believe must change my array to a binary data word, for this to work?

The main question is: Can I simply write my data word to SPI module using Code? If so, why is it mandatory to connect MOSI input and what should i connect to it?

Thanks guys

pastedImage_0.png

0 Likes
1 Solution

So you need to increase the slave's width to 15.

SPI works as:

For every bit the SPIS interface gets, one bit is returned immediately. When the very first byte is sent, the interface usually does not "know" yet what to answer, so a dummy byte is returned which should be skipped.

SPI has no read command, so you must send dummy bytes to retrieve the information wanted.

There is no sync or parity defined for SPI, you need to handle those in software.

Bob

View solution in original post

0 Likes
3 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You should ground the MOSI pin to have a defined input.

I count more than 12 clock cycles on your picture. Sure you do not have 15 bits to transfer?

Bob

0 Likes
Anonymous
Not applicable

Yes, I'm sure. That is the only way this particular master communicates. 1'st is for sync (sadly, I don't know how to make SPI start from the 2'nd), and the other ones are error and parity bits.

I will try grounding MOSI, thank you

0 Likes

So you need to increase the slave's width to 15.

SPI works as:

For every bit the SPIS interface gets, one bit is returned immediately. When the very first byte is sent, the interface usually does not "know" yet what to answer, so a dummy byte is returned which should be skipped.

SPI has no read command, so you must send dummy bytes to retrieve the information wanted.

There is no sync or parity defined for SPI, you need to handle those in software.

Bob

0 Likes