You are here

SPIS RX buffer data incorrect | Cypress Semiconductor

SPIS RX buffer data incorrect

Summary: 1 Reply, Latest post by hli on 29 Sep 2016 03:35 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
Evan D's picture
User
24 posts

Could someone provide a sanity check for me. I have an SPI slave module with an 8 bit word, 8 byte RX buffer, and an interrupt that triggers when the buffer is not empty. The interrupt toggles a flag which then executes :

if(SPIS_GetRxBufferSize() >7){         //wait until all 8 bytes of data have arrived
         x.b[0] = SPIS_ReadRxData() ;   //increment through the buffer
         x.b[1] = SPIS_ReadRxData() ;
         x.b[2] = SPIS_ReadRxData() ;
         x.b[3] = SPIS_ReadRxData() ;
         y.b[0] = SPIS_ReadRxData() ; 
         y.b[1] = SPIS_ReadRxData() ;
         y.b[2] = SPIS_ReadRxData() ;
         y.b[3] = SPIS_ReadRxData() ;
        
        SPIS_ClearRxBuffer();     //clear the buffer for the next set of data
        SPIS_ReadRxStatus();
 
   }

The issue I have today is that when I repeatedly send 0x0a and 0x0b (to test) the first byte is correct but then the rest are '05' (hexadecimal printout) (and for the next buffer all are 05). If I repeatedly send just one byte (0x0a for example) all bytes in the buffer are '0A' .This makes no sense to me. Is the code above correct? 

Thanks,

Evan

 

 

 

hli
user_78878863's picture
User
2680 posts

Are you sure the SPI configuration matches between master and slave? Ist looks as if your slave is missing the first bit. Also, check that there is no crosstalk between your SPI lines (e.g. slave select and clock). Maybe check with a scope that you actually transmit what you think you transmit.

Log in to post new comments.