Skip to content

Commit 5b1600c

Browse files
committed
Portenta: UART: use PLL2Q as clock source
1 parent 221a1c1 commit 5b1600c

File tree

1 file changed

+30
-0
lines changed
  • targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7

1 file changed

+30
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#include <stdbool.h>
2+
#include "device/stm32h7xx_hal.h"
3+
#include "device/stm32h7xx_hal_uart.h"
4+
5+
extern bool isBetaBoard();
6+
7+
void HAL_UART_MspInit(UART_HandleTypeDef *huart) {
8+
9+
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct = {0};
10+
11+
//printf("called HAL_UART_MspInit\n");
12+
13+
//PeriphClkInitStruct.PLL2.PLL2State = RCC_PLL_ON;
14+
//PeriphClkInitStruct.PLL2.PLL2Source = RCC_PLLSOURCE_HSE;
15+
if (isBetaBoard()) {
16+
PeriphClkInitStruct.PLL2.PLL2M = 27;
17+
} else {
18+
PeriphClkInitStruct.PLL2.PLL2M = 25;
19+
}
20+
PeriphClkInitStruct.PLL2.PLL2N = 200;
21+
PeriphClkInitStruct.PLL2.PLL2P = 2;
22+
PeriphClkInitStruct.PLL2.PLL2Q = 2;
23+
PeriphClkInitStruct.PLL2.PLL2R = 2;
24+
25+
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LPUART1 | RCC_PERIPHCLK_USART234578 | RCC_PERIPHCLK_USART16;
26+
PeriphClkInitStruct.Lpuart1ClockSelection = RCC_LPUART1CLKSOURCE_PLL2;
27+
PeriphClkInitStruct.Usart234578ClockSelection = RCC_USART234578CLKSOURCE_PLL2;
28+
PeriphClkInitStruct.Usart16ClockSelection = RCC_USART16CLKSOURCE_PLL2;
29+
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
30+
};

0 commit comments

Comments
 (0)