When reading from SPI you have to call SPIM_TxDisable() before, when wanting to transmit call SPIM_TxEnable().
Not working communication is mostly caused by different clock / mode, check that twice.
Thank you for your response.
I have been using TxEnable/TxDisable before and after reading and writing. I measured the clock cycle on the oscilloscope and it was at the correct frequency required for our application. The mode also seems to be correct. However, is there anything else on the sdata pin that I need to change (like open drain/strong drive etc.)? Also, should I clear the buffer upon every read and write? And I discovered that CheckBufferSize() seems to take the data from the buffer. How does that function?
Can you post your project here so that we can have a look at? Maybe there is something not as you want it.
To do so, select Build->clean project
File->create workspace bundle(minimal)
Then upload the compressed file here.
A couple of things,
1.Get the latest PSoC Creator
2. I noticed you have connected the Chip Select pin to your SPI module directly.
I think thats the issue.You see,that is one devious chip select on the SPI module.The problem is,the SPI master toggles this around sending and getting a byte.when ideally,it should be toggled around a transaction.
Toggle the CS manually,around an entire transaction.
//Send SPI command to accelo
//Get some funky data back
I guess that should do it.
i.e it should look like this-->
Note that Reset should be connected to 0..(but oddly enough even the example project in the recent edition of creator doesnt..)
I'm trying to use the SPI master in the same way.
So far I've been able to read data as well.
The issue got is when managing the bidirectional I/O.
When I switch form input to output, it seems get locked in that state.
It has been one of the questions mentionned above.
Do we have to manage the bidirectional I/O drive mode when using SPI 3-wire?
Thank you for your time.
Datasheet says for SPIM
SPIM_TxEnable() and SPIM_Tx_Disable() API functions should be used to switch between Rx and Tx mode.
and for SPIS
SPIS_TxEnable() and SPIS_Tx_Disable() API functions should be used to switch between Rx and Tx mode.