2020-07-24 06:44 AM
I think I'm misunderstanding something with the generic SPI transmit procedure. I'm working with the STM32L432, but I think that's the standard SPI device for most MCUs. My scenario is with the MCU as Controller rather than Peripheral...
My issue is with knowing when to de-assert the CS line. According to the documentation, I can either use Hardware or Software control of the CS:
Ummm... isn't that the same thing? The same trigger that could de-assert `SPE` could equally de-assert the relevant GPIO?
My SPI device requires CS for the duration of the transmit cycle, including the final few bits (which is my problem). I need to know when to de-assert CS:
In short, the only way I can know to de-assert CS is to wait on the BSY bit... which has no interrupt. Is ST seriously expecting me to go into a Busy Wait loop? On every Transmit?
2020-07-24 12:56 PM
after few billions sold chips, obvious issues are probably not show stopper...
In master mode, bi dir, use rxne interrupt. txe kicks before transmitting the first bit. receivingis only when the last bit has been received. make sense? watcg out that there are few evolutions of spi ip. here is for the basic one.
2020-07-24 01:26 PM
> Ummm... isn't that the same thing?
Controlling a GPIO pin is often more convenient from a software side since the SPE bit behavior is embedded within the HAL library.
> In short, the only way I can know to de-assert CS is to wait on the BSY bit...
You could also trigger off of a transfer complete on the receive side. Receive data into a dummy buffer.