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
Attempting to use SPI(6) on STM32H747BIT6 does not seem to work.
Port, board and/or hardware
I am using a custom board with STM32H747BIT6
MicroPython version
Micropython 1.23 on stm32h747BIT6 using a custom board.
Reproduction
Spi device is created with..
spi1 = SPI(6, baudrate=1000000, polarity=0, phase=0, bits=8 )
later attempt to write to this device generates a timeout.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "main.py", line 112, in <module>
File "valve_control.py", line 84, in init
File "valve_control.py", line 148, in drv_spi_write_buf
File "valve_control.py", line 131, in drv_spi_write_reg
OSError: [Errno 110] ETIMEDOUT
So the device appears to be there, I have defined thee pins in mpconfigboard.h
#define MICROPY_HW_SPI6_SCK (pyb_pin_SPI6_SCK)
#define MICROPY_HW_SPI6_MISO (pyb_pin_SPI6_MISO)
#define MICROPY_HW_SPI6_MOSI (pyb_pin_SPI6_MOSI)
Expected behaviour
I was expecting micropython to perform the write to the SPI6 port on the stm32h747BIT6 device.
Observed behaviour
However, I get the following instead.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "main.py", line 112, in <module>
File "valve_control.py", line 84, in init
File "valve_control.py", line 148, in drv_spi_write_buf
File "valve_control.py", line 131, in drv_spi_write_reg
OSError: [Errno 110] ETIMEDOUT
It is almost as if the pins are not actually being configured for output via the spi, like the alternate function register is not being set up?
I'm guessing this might be a bug in configuration management when micropython starts up, but so far I've not been able to find any documentation that indicates the correct way to set up a new hardware spi port.. The code appears to be there for SPI device 6. It just does not seem to actually function, though.
Additional Information
No, I've provided everything above.
Also, I THINK this is a bug, but it might be that I need to posts this some where else, if so, please provide me with a whack from a clue by four so I can put this in the right place.
Thanks!
Code of Conduct
Yes, I agree