STM32H7 SPI6 not working with DMA
Hi,
I was trying this out on a custom board as well as the Nucleo STM32H743SZI board, and while SPI3 works when sending multiple bytes (default behavior when sending more than 1 byte seems to be to use DMA per spi.c), when it comes to SPI6, it uses a different DMA engine (DMA2) and goes through a mux BDMA_REQUEST_SPI6_TX/RX. I keep getting a ETIMEDOUT error due to waiting for the interrupt to come back from the DMA transaction. Any advice, or could this be a bug?
Thanks,
Rob
STM32H735 SPI6 works only on sigle byte transfers because of not implemented BDMA
Port, board and/or hardware
STM32H735 custom hw
MicroPython version
MicroPython v1.23.0-preview.420.gb7506f8fe.dirty on 2025-04-01; PCFJ1-H735IGT6 with STM32H735
Reproduction
I think this would happen on any other STM32H7 with SPI6. Init SPI6 with any parameters, and send 1 byte, this will work, send 2 or more, and it will throw timeout exception.
There is already some condition checking on the transmit / receive functions (for only 1 byte, it will send blocking, according to some comments in the code DMA for 1 byte didn't work). If you extend this condition to:
if (len == 1 || query_irq() == IRQ_STATE_DISABLED || self->spi->Instance == SPI6) {
status = HAL_SPI_Transmit(self->spi, (uint8_t *)src, len, timeout);
And also do the same for the other transfer modes, SPI6 will work in blocking mode.
Another solution would be to implement the BDMA in "ports/stm32/dma.c" around line 1769. It is written there, that BDMA is currently not supported, my solution at least gives blocking functionality to SPI6.
Expected behaviour
To be able to send multiple bytes on SPI6
Observed behaviour
Thrown exception upon trying SPI6 multiple byte transfer: ETIMEDOUT
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree