2021-06-17 12:10 AM
Hi all,
I am now using STM32F205 w/ STM32cubeIDE & STM32cubeMX to make a project with timers. I find that the timer seems not accuracy. So I make a test code to test it (see attached project). For short, it is just
Timer_start()
while(1)
{
if(timer.value % 10 == 0){toggle GPIO_PA6}
if(timer.value % 100 == 0){toggle GPIO_PA7}
}
It works ok if I choose
clock source = internal clock/2
prescaler = 60000
counter value = 60000
auto preload
But things go wired when
clock source = internal clock/4
prescaler = 30000
counter value = 60000
auto preload
I expect both of them have the same result as the code & harware are the same in all cases.
In fact, GPIO_PA6 works find in both case. But the period of GPIO_PA7 seems shorten in case2 (see pic). And some time there are even no signal output and it will resume after around 10 sec. Do I misunderstand the usage of prescaler?
2021-06-17 12:32 AM
Which prescaler?
What is the question?
JW
2021-06-17 12:34 AM
Sorry for pressing the wrong button before I finish typing