SPIS RX buffer data incorrect

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

cross mob
Anonymous
Not applicable

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

0 Likes
1 Reply