2025-10-08 8:51 AM
At STM32G431 Is it possible to make a (SPI daisy chain) shift register with one cyclic ringbuffer.
With SPI peripheral as Full duplex Slave, with 2 DMA (RX TX) channels.
"HAL_SPI_TransmitReceive_DMA(SPI_GetHandle(), ringbuffer, ringbuffer, SPI_size); "
And stop DMA once NSS external pin interrupt accors ( rising edge).
Or in other words read and write to same buffer in dma is that possible?
I tested and it was working. Is this lucky or indeed possible, because SPI Transmit (read from buffer[x]) always happens before receiving (write in buffer[x]) from same index and therefore always guaranteed it works ?
Solved! Go to Solution.
2025-10-08 9:29 AM
Yes, you can read and write to the same buffer. TXE is serviced first, so you will transmit the current content of the buffer and later receive data coming in. Writing only occurs after RXNE, which can only happen after the byte is already transmitted.
2025-10-08 9:29 AM
Yes, you can read and write to the same buffer. TXE is serviced first, so you will transmit the current content of the buffer and later receive data coming in. Writing only occurs after RXNE, which can only happen after the byte is already transmitted.