From 20a95b249a439b4dc57da0c2beccac35ec45db76 Mon Sep 17 00:00:00 2001 From: nspsck Date: Fri, 17 Nov 2023 12:48:53 +0100 Subject: [PATCH] stm32/system_stm32: Allow selection of OSPI clock source. Added a #if-block to `system_stm32.c` to check whether `MICROPY_HW_RCC_OSPI_CLKSOURCE` is defined. If that is the case, the clock source for the OSPI will be changed to the specified source. Signed-off-by: nspsck --- ports/stm32/system_stm32.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ports/stm32/system_stm32.c b/ports/stm32/system_stm32.c index 2cff36c3a..b76a41e97 100644 --- a/ports/stm32/system_stm32.c +++ b/ports/stm32/system_stm32.c @@ -461,6 +461,11 @@ MP_WEAK void SystemClock_Config(void) { PeriphClkInitStruct.QspiClockSelection = MICROPY_HW_RCC_QSPI_CLKSOURCE; #endif + #if defined(MICROPY_HW_RCC_OSPI_CLKSOURCE) + PeriphClkInitStruct.PeriphClockSelection |= RCC_PERIPHCLK_OSPI; + PeriphClkInitStruct.OspiClockSelection = MICROPY_HW_RCC_OSPI_CLKSOURCE; + #endif + #if defined(MICROPY_HW_RCC_SPI123_CLKSOURCE) PeriphClkInitStruct.PeriphClockSelection |= RCC_PERIPHCLK_SPI123; PeriphClkInitStruct.Spi123ClockSelection = MICROPY_HW_RCC_SPI123_CLKSOURCE;