Hi,
I’m working on custom firmware for the CW308 STM32F405 target. I need to run the core from PLL (e.g. 168 MHz SYSCLK, APB1=42 MHz, APB2=84 MHz) so UART and timing work correctly.
-
The stm32f4_hal.c file has three branches: USE_INTERNAL_CLK, USE_PLL and else,
( -
No matter how I set the defines, I always seem to fall into the else path. I say seems because I have attached a debugger and stepped through and the code APPEARS to be following the correct path and setting up the PLL however, no matter what values I use I end up with HSE_BYPASS with CW’s 7.37 MHz clock, which gives me HAL_RCC_GetPCLK1Freq() and HAL_RCC_GetPCLK2Freq() ≈ 7.37 MHz.
-
UART baud calculation is then wrong: USART→BRR ends up ~32, TX gets stuck in UART-WaitOnFlagForever and I only see one tiny blip on PA9.
I’ve tried:
-
Setting USE_PLL and configuring PLLM/N/P/Q for 168 MHz, and also 84
-
Setting FLASH_ACR_LATENCY_5WS before switching SYSCLK,
-
Verifying with debugger that code reaches the PLL branch.
But UART never works unless I fall back to the default HSE_BYPASS case.
Questions:
-
What’s the intended way to configure PLL on CW308 STM32F405 targets?
-
Is there anything in the CW setup (e.g. jumpers, HS2/OUT clock wiring, stripped-down HAL) that forces you into HSE_BYPASS?
-
Do I need to provide my own minimal clock setup (bare-metal register writes) instead of using the provided stm32f4_hal.c
Any pointers would help — I’m just trying to get PLL-based clocks working so UART baud is stable at 1M-2M.
Thanks!