Change SPI6 source clock to PLL2 on STM32H743 (Nucleo or custom)

I’m looking to change the STM32H743 SPI4, 5 & 6 source clocks from PCLK1 and 4 to PLL2. I have added the PLL2 setup in system_clock.c but when I change the source clock in stm_spi_api.c/spi_init_direct() to RCC_SPI6CLKSOURCE_PLL2 (in the case of SPI6) any call to .format() or .frequency() appears to halt the calling thread.

I’m running on a custom board simply based on the STM32H743xI mbed OS target so debugging and a number of other nice to have (like Intellisense) aren’t available. I’ve tried to follow down into spi_init() but haven’t been able to find where the resulting hspi->MspInitCallback(hspi) source code is.

Hi

I changed Arduino connector configuration to be able to test easily SPI6,
and it seems it has worked well
See NUCLEO_H743ZI2 : SPI6 test ok · jeromecoutant/mbed@fe0be6c · GitHub

Jerome

you can use VSCode and Cortex-Debug extension and a debug probe like STLink or some others, then debugging is possible with every board. Also Intellisense works with the standard extensions.

Hi Jerome,

Thanks for the quick reply.

I had no problem configuring SPI4, 5 & 6 for operation but based on PCLK1 and PCLK4 the closest I could get to 10 MHz is 7.5, i.e. 120/16. Setting up PLL2 in system_clock.c is straight forward and the analog input setup code (if used) can be used as an example. Where I ran into problems is when I called .format() and .frequency(), i.e.:

//###
SPI spi6(PG_14, PG_12, PB_3_ALT1);

spi6.format(16,3);

and/or

spi6.frequency(10000000);
//###

Both calls appear to use init_spi() callbacks (which I can’t seem to track the code down for) that don’t return. Having debugger capabilities would really be nice (I have STLINK-V3) to follow this through but mbed doesn’t have that working for custom targets yet. I will try to track down our NUCLEO_H743I2 to give it a go but it seems to have grown legs …

Cheers!

Hi,

Thanks for this suggestion. I’m currently using Mbed Studio 1.4.3 (ARMC6), which doesn’t export to VSCode. I’m also using some of the bootloader capability of mbed OS using mbed_app.json. I’m getting close to first release on this project so changing tools right now is risky.

Any comments/suggestions/opinions on GNU vs ARMC6 and bootloader support are welcome.

Cheers!

can you zip the modified files and post it or do you have a repo? I have a H743 just beside me.

grafik