STM32U575 incorrect timing
I am testing the functions of STM32U575 and found the following issue.
I simply wrote this in main():
while(1){
for(i=0;i<160;i++);
HAL_GPIO_TogglePin(GPIOC, GPIO_PIN_11);
}
where i is defined as uint32_t.
HCLK is set to 160MHz by using PLLCLK with source=16MHz HSE, M=1, N=10, and R=1. Therefore the Cortex System timer is also 160MHz.
But I found the PC11 pin toggles at a cycle of about 17.2us with ICACHE on and about 45us with ICACHE off, instead of about 1us expected. DCACHE is always on.
I tried changing the Cortex System timer frequency but found it has completely no effect on the toggling frequency.
I have also enabled TIM2 and generated a PWM which performs correctly, showing that HSE is working correctly.
Why did this issue occur and how to solve it?
Thanks in advance.
