- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there !
Can anyone tell me please how send many bytes on spi bus (using the API for SPIM) without get SS high before sent all the bytes ?
Thank you very much.
- Labels:
-
PSoC 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I normally control the cs pin myself via a control register output.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So you should check the SPIM_ReadTxStatus() for STS_TX_FIFO_NOT_FULL in a loop until you have sent all your bytes to the SPIM. The transfer is handled by the component. When you are using the high-level API SPIM_PutArray() all this will be handled by the internals.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This depends on the SPI frequency. When it is too high, even using an interrupt to refill the FIFO is not fast enough. In this case SS will go high even though it should not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If that does not work, you may use HI's hint and control a ss-signal yourself.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you very much Bob and hli for your valuable help.
Thanks both of you , with your suggestion and experience , finaly I could establish comunication with nRFL24L01+.
The point was that that chip has a SPI and requires hold its CSN ( chip select) low over the entire transaccion for send a write or read comand to set Registers or Verify Register.
I 'm using SPIM API and when I need to send two bytes and receive two ( status register and other one), there is no issue with the API.
The issue come up when I am trying to send a read or write comand byte with 5 or more byte long. At that time API does not work.
I suppose it happend because ss ( ss( SPIM API) ------->CSN ( nRF24L01+) ), goes high - low- high, with every SPIM_WriteTxData or SPIM_ReadTxData.
I have tried to use void SPIM_PutArray(const uint8/uint16 buffer[], uint8 byteCount) .
Taking a look to this fuction, it has a loop with SPIM_WriteTxData, and that implies that ss is getting" low and high too."
So, based on both of you suggestion I have controlled CSN independently of API. I have used a control register for that.
And !!!!!! every think work ok so far.
So Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alex, you are always welcome!
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As said above, when you configure tha SPI buffers to more than 4 bytes (which I assume you did), an internal ISR is used. And it might just not be fast enough to supply the data fast enough before the SPI runs out of data to send. (And if not, a similar thing happens when you send more than 4 bytes with a 4 byte buffer, but then its the API method doing this magic)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Good to here that
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Gee, folks, I really should have read your posts before I spent a few days figuring this out by myself. I have exactly the same problem. SS goes high before I could put another byte through WriteTxData(). While the slave sees SS going high, it reset itself and call it a day! I am going to use a control register like you guys suggested!