Problem with SPIM, I can't receive anything | Cypress Semiconductor
Problem with SPIM, I can't receive anything
Sorry, I just solved my problem while gathering the data to get support but the solution creates another question for me, why does what I explain below happen when I use a buffer superior to 4 bytes? I know the SPIM have a 4byte hardware buffer but why it doesn't work when using software buffer? I had the SPIM configured for 28 bytes.
I'm interfacing the PSOC 4 with an ADS1298. I'm trying to get some that out of the ADS1298 so I only have to provide clock to it to receive some of the data.
I do that correctly and it sends data since I can see it in the scope. The problem is that I can't read any data with the SPIM.
This is the loop where I keep receiving data.
while(!(SPIM_1_ReadTxStatus() & SPIM_1_STS_SPI_DONE));
while(!(SPIM_1_ReadRxStatus() & SPIM_1_STS_RX_FIFO_NOT_EMPTY));
payload[i] = SPIM_1_ReadRxData();
If tried commeting the first while and the second or adding the delay with no luck. If I don't comment the if(SPIM_1_GetRxBufferSize()>0) it gets stuck there because it is not reading anything but it is receiving data since I can see it with my scope.
The solution was to change the RX buffer size to 4.