Hello, I've run into a bit of behavior I am struggling to figure out. I am using a SPI master in full duplex mode using only the hardware FIFO (no interrupts) to communicate with an external chip. I can write just fine via SPI to the device. I can also see that the device is responding correctly to my SPI master commands in that the anticipated data are returned as seen by a logic analyzer. That being said, the SPIM_ReadRxData from the Creator API does not behave as expected. This is because the SPIM_GetRxBufferSize() is returning an incorrect number of bytes.
If I transmit 3 bytes of data through SPIM, I should receive 3 bytes of data (even if it's garbage) because it is shift-register based and sync'd with the master clock. Well, I get sometimes one, but usually zero bytes. So, I'm confused. Here is the snippet of code. Does anyone have any thoughts on the matter?
I am attaching a PNG of the master clocking data out of the slave. The master writes a 0x21 to get data from the slave followed by two dummy bytes. The dummy bytes are correctly verified to contain 0x81 and 0xC3. The PSoC does not received these bytes for some reason.
data_returned.PNG 68.8 K