2022-08-16 11:05 AM
Hello Support Team,
Currently, I am working on the STM32H745-Disc board.
In that, I have used the SPI2 module and I have also configured the baud rate as a 3Mbit/s using the STM32CubeMX configuration tool and generated code for the same. (SPI Init done Inside the main() function)
Now, I need to change the SPI2 module baud rate to 12Mbit/s from 3Mbit/s baud rate at run time.
Please suggest any API or an appropriate way for the above scenario.
Thanks In Advance.
2022-08-16 02:01 PM
The HAL doesn't have such API.
2022-08-16 02:12 PM
As long as the SPI port is idle, you can change the baud rate bits. Either reading/writing directly to the register (CR1, at least in the G4/F4 series, don't know about the H7), or perhaps look at the HAL LL functions if you want a wrapper around the direct register writes. You'll need the H7 reference manual, if you don't already have a copy.