From 2afce67e5c8d841d967d6279a5baec20ab0dea66 Mon Sep 17 00:00:00 2001 From: Erwan GOURIOU Date: Tue, 31 May 2016 16:46:05 +0200 Subject: [PATCH] [STM32F4][V1.12.0] SystemCoreClock update With ARM and uARM toolchains, SystemCoreClock is reset before UART init by libc. Fix to perform SystemCoreClock init with UART init out of HAL init. --- hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c index c489a7e37c..27361731aa 100644 --- a/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c +++ b/hal/targets/hal/TARGET_STM/TARGET_STM32F4/serial_api.c @@ -182,6 +182,10 @@ static void init_uart(serial_t *obj, UARTName instance) } #endif + /* uAMR & ARM: Call to UART init is done between reset of pre-initialized variables */ + /* and before HAL Init. SystemCoreClock init required here */ + SystemCoreClockUpdate(); + if (HAL_UART_Init(handle) != HAL_OK) { error("Cannot initialize UART\n"); }