Today, while I was studying the problem of npuruss-san,
I encountered an interesting behavior of SPIS.
With this project I'm using a couple of CY8CKIT-044s,
one for SPI_Master and the other for SPI_Slave.
When I call SPIM_PutArray(), the SPI_Slave receives exact
data assigned by SPIM_PutArray().
But after I call SPIS_PutArray() and when SPI_Master
send another transaction, the MISO data sent out from
SPI_Slave is 1 byte off from the data assigned by SPIS_PutArray().
For example, for the first loop, before SPI_Master sends anything,
I put 0D,0C,0B,0A,09,08,07,06,05,04,03,02,01 to SPIS_PutArray().
When SPI_Master sends commands, SPI_Slave sends out
(See attached Oscilloscope Screen Shot)
Naturally, SPI_Master received
although it was expecting to receive
Then for the next transaction, SPI_Slave prepares sTxBuffer with
But SPI_Master receives
(This 01 seems to be the last byte of the previous PutArray())
Again, SPI_Slave prepare sTxBuffer with
And SPI_Master receives
(This 3C seems to be the last byte of the previous PutArray())
So I suppose that with this project,
SPIM_PutArray() generates correct data on MOSI pin
SPIS_PutArray() generates 1byte data from previous SPIS_PutArray()
before sending the data assigned by current SPIS_PutArray().
Now my question is:
Am I missing something to make SPIS_PutArray() work correctly?
Or is/are there way to reset the data pointer of SPIS
so that I can send correct data?
Attached are my test projects and log/screen copies.