Is it possible to trigger a SPI transfer complete interrupt using circular DMA with 3 byte buffer on STM32F072
I'm working on a board that has a string of 6 SPI quad FET chips whose outputs I'm trying to PWM in software. The string of FET drivers have a latch signal to transfer the shifted data to the outputs. Because the DMA uses the SPI peripheral's FIFO, I need to generate the latch signal after every 3 bytes DMA'd to the SPI peripheral. It would seem that I need to set the SPI peripheral's FIFO size to 3 bytes and setup a SPI interrupt every time the SPI FIFO has emptied *and* the SPI data register is empty (i.e., after every 3rd byte has been completely shifted out). I don't see a way to set the SPI FIFO size. Since the FIFO size is 32-bits, I could send 4 bytes at a time (with one dummy byte) with the TXEIE (Transmit FIFO ready to be loaded) interrupt bit set, and when that interrupt occurred, if a TX complete interrupt was available I could enable that then to allow me to know when the entire 4-byte sequence was transmitted so that I could synchronously generate the latch signal to the SPI FET chips. Since that latter interrupt does not exist, I don't see any way that I can use DMA or simple SPI transfers *and* synchronously generate the latch signal for the SPI FET chips. Can anyone suggest a method to do this (i.e., DMA 3 bytes (in circular DMA mode, if possible) and after every 3rd byte was completely shifted out of the SPI peripheral then toggle an I/O pin twice to generate the latch signal, before starting the next 3 byte sequence)?
