- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use the SPI Master block in bidirectional mode (only one sdat pin instead of MOSI and MISO). I can't seem to get a read signal. Is there anything specific I need to do in the programming or in the TopDesign differently from the MOSI/MISO mode? How should I be using TxEnable/TxDisable methods?
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solution?
Toggle the CS manually,around an entire transaction.
AccSPI_CS_Write(0);
//Send SPI command to accelo
//Get some funky data back
AccSPI_CS_Write(1);
I guess that should do it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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..)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
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.
David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Bob