2022-09-02 01:30 AM
(1) cannot run at 84Mhz, it will stuck at Error Handler
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 16;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV8;
RCC_OscInitStruct.PLL.PLLQ = 4;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
(2) can run at 42Mhz but will keep looping inside the loop forever and cannot timeout
/* Wait till HSE is ready */
while(__HAL_RCC_GET_FLAG(RCC_FLAG_HSERDY) == RESET)
{
if((HAL_GetTick() - tickstart ) > HSE_TIMEOUT_VALUE)
{
return HAL_TIMEOUT;
}
}
}
else
2022-09-02 01:47 AM
What is your hardware? Is there a crystal connected to HSE pins?
JW
2022-09-02 03:42 AM
@JTse.1
2022-09-04 10:05 PM
2022-09-04 10:13 PM
2022-09-04 10:40 PM
your osc circuit should look like this:
show your circuit, if you expect any useful help.
2022-09-04 11:32 PM
2022-09-05 12:50 PM
You posted the same post 3 times, each sentence is on a separate line and the space between lines consists of 3 empty lines. It's worse than spam! Edit those posts so that the topic is readable.
2022-09-05 02:33 PM
Please don't repetitively post the same material, post it once, everyone can see it.
Here's the App Note https://www.st.com/resource/en/application_note/cd00221665-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf
Show your circuit as constructed.
The HAL Tick requires SysTick to be up and running.
The crystal has to start. The output can be probed if you enable it's output on PA8/MCO pin.
The MCU can crash if the PLL and FLASH wait states are wrong.
Make sure HSE_VALUE define in stm32f4xx_hal_conf.h reflects the speed of your external crystal.
2022-09-05 09:04 PM