I am streaming output on MAX32660 SPI0 at 48Mbaud. Since it is streaming, I can't predict the length when I start sending.
The problem I'm running into is that slave-select assertion and deassertion seems to be based on
SPI0_CTRL1.tx_num_char. I can maintain transmission by periodically writing a large number to
SPI0_CTRL1.tx_num_char, and writing bytes directly into the 32-byte hardware FIFO as they become available. But then when I get to the end of the stream, how do I tell hardware that I'm done with the transaction? I tried writing
SPI0_CTRL1.tx_num_char to 0 (or 1 and then writing a final character), but it didn't work completely. The SPI clock stops after everything is transmitted, so all data is properly handled, but the slave select remains asserted.
It's a bit odd that
SPI0_CTRL0 has a
start bit, but no corresponding bit to stop. Surely I don't have to know the length in advance?
I suppose I could just use another GPIO as a slave select, which would also enable me to use more than one peripheral. Is that what everyone does? But then why do they bother with all the fancy slave-select timing features in hardware? (Do the manufacturers do this just to make us think we need to buy a more expensive device if we want more than 1 slave select?)
Or is there a more proper way (i.e., more likely compatible across multiple devices) to start and finish streaming SPI output?