stm32/spi: Fix baudrate calculation for H7 series.

Fixes issue #6342.
This commit is contained in:
Reinhard Feger 2020-08-22 18:48:21 +02:00 committed by Damien George
parent 0facd891e7
commit 79c186f5c9

View File

@ -633,7 +633,11 @@ void spi_print(const mp_print_t *print, const spi_t *spi_obj, bool legacy) {
if (spi->State != HAL_SPI_STATE_RESET) {
if (spi->Init.Mode == SPI_MODE_MASTER) {
// compute baudrate
#if defined(STM32H7)
uint log_prescaler = (spi->Init.BaudRatePrescaler >> 28) + 1;
#else
uint log_prescaler = (spi->Init.BaudRatePrescaler >> 3) + 1;
#endif
uint baudrate = spi_get_source_freq(spi) >> log_prescaler;
if (legacy) {
mp_printf(print, ", SPI.MASTER");