- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.