You are here

SPI - MASTER | Cypress Semiconductor


Summary: 3 Replies, Latest post by martin.gonzalez71_1573081 on 03 Oct 2016 10:06 AM PDT
Verified Answers: 2
Last post
Log in to post new comments.
AdityaK's picture
15 posts

Hi All,

I am using SPIM component. I want to read back the MISO data. Using logic analyzer i can see the data. But how to store that data in any variables???

please see my code for your reference. Please let me know what modification is needed.


while(!(SPIM_ReadTxStatus() & SPIM_STS_SPI_DONE)){}

while (SPIM_GetRxBufferSize()==0);
u8RSUAdcValue1=(uint8) SPIM_ReadRxData(); //always returns the value 0. ???

user_1377889's picture
9256 posts

You have to expect 3 bytes : one as the return of sending the command byte and two bytes for the sent zeroes. Because sending and receiving runs in parallel in SPI conversions you can be sure that after the while(!(SPIM_ReadTxStatus() & SPIM_STS_SPI_DONE)){}

your SPIM_GetRxBufferSize() returns 3.

And for heavens sake use someting like

#define Wait(x)


while (SPIM_GetRxBufferSize()==0) Wait();

That will be quite better readable than just a semicolon.. 



Hi Bob


Could you help me with the PSoC 5 LP and Arducam mini Communication device, I don't understand how to do the Inicialitacion of Protocol SPI and verify the response of arducam 


Thank you 

user_78878863's picture
2551 posts

Whenever a SPI master writes a value, it also read a value back in. So when you send the Control_Byte, the master reads a value which contains a dummy value. You need to throw this away. So only the second byte you read is valid.

Log in to post new comments.