Content originally posted in LPCWare by MindBender on Tue Jul 21 02:11:30 MST 2015
Quote: wmues
Please do not mix slave mode with master mode.
I didn't mix them up; I just assumed that according to the timing diagrams, our existing master must release the LPC slave's SSEL between frames in order to have the LPC slave work correctly.
Quote: wmues
In master mode, the SPI can handle the SSEL (chip select) automatic. The SSEL is active for the duration of 1 word (4-16 bit).
If you write another word into the SPI data register while the last transfer is running, the SSEL line stays low between 2 words.
But: this is not reliable, because interrupts and/or DMA transfers may delay the writing into SPI data register.
So, in master mode, it is the best to handle SSEL by hand.
That's a nice caveat indeed. We're not using master mode on the LPC for now, but I'll try to remember it in case we do.
Quote: wmues
In slave mode, SSEL is simple a qualifier for data transfer.
So our existing master doesn't need to deactivate and reactivate the LPC slave's SSEL in between frames?
If SSEL is just a simple qualifier, that does mean that it's not really suitable to indicate the start of a datagram. But that is how it is currently used. I suppose I have to connect an extra GPIO to it, to get an interrupt when it is activated and deactivated, allowing me to separate datagrams.
Quote: wmues
If you want to transfer a block of data, you might want to use DMA to transfer the incomming data into memory. You may connect the SSEL to a GPIO port and fire an interrupt at the end of the block.
Exactly, great idea.
Quote: wmues
In the interrupt, you setup the DMA for the next block. If each block has the same length, you might use the DMA interrupt. (I WOULD NOT DO THAT. It's a loss of handshaking!)
I'll see if I can get it working by polling the registers first. After that I'll use interrupts and when that is working, I'll add DMA. Probably as you suggested: Setup DMA when SSEL is activated, disable DMA an notify the rest of the application when SSEL is de-activated.
Quote: wmues
You may need some sort of handshaking to signal the master that the interrupt handling is done. Or you define a maximum time for interrupt handling, and the master sends the next block without handshaking.
Our application is not that complecated; We only need to listen, for now.
Thanks guys!