cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F205 timer goes wired after changing the prescaler

SSin
Associate III

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?

2 REPLIES 2

Which prescaler?

What is the question?

JW

Sorry for pressing the wrong button before I finish typing