I have gone through the application. Can you tell me whether the error is occurring due to Write operation or Read operation of CySpiReadWrite() API?
Are you seeing that error in the following debug print in the thread handler:
printf("read write :- ERROR(%d)\r\n", rtnStatus);
I am interested in only reading the SPI in slave mode so here txbuff is used as dummy
Txdata and Rxdata has same buffer length and txdata buffer is filled with '00' dummy
CySpiReadWrite(hSPI, &myRxData, &myTxData, 5000);
as per above case some time it works some time it does not.
if I use it like this telling the read/write api that i dont want write operation
CySpiReadWrite(hSPI, &myRxData, NULL, 5000);
then it never reads the SPI data, first call returns error:6 and subsequent calls returns timeout