STM32F446RET6 Timer and clock
Hi,
I designed the us and ms delay functions using timer 2 and 4.


Initially in the PLL source, I was using HSI, but it had some errors, so I switched it to HSE. I was using my delay function to control the DAC output, but when I switched to HSE, all my delay functions became twice as long.

This is my code.
while (1)
{
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 2854); //
Delay_us(500);
HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 868);
Delay_us(500);
HAL_DAC_SetValue(&hdac, DAC_CHANNEL_1, DAC_ALIGN_12B_R, 1861);
Delay_ms(10);
}
This is the waveform of the oscilloscope.

In the clock tree settings, I only switched the clock source to HSE, and the divider settings did not change. I wonder why this happened.
Best,
