2020-01-17 10:26 PM
part number: STM32F779BI
I am using clock frequency 108 MHz ( not system clock , system clock is 216 MHZ)
I don't want to use loop
if not possible what is the maximum value i could set using timer
Solved! Go to Solution.
2020-03-03 08:09 PM
@turboscrew that is also not getting 10 milliseconds of timer
2020-03-03 08:24 PM
Are you going to tell how long is it then, or do we have to guess?
2020-03-03 08:36 PM
2020-03-03 09:13 PM
In that case, check your clock tree.
2020-03-03 09:26 PM
2020-03-03 11:47 PM
How do you know that it's 333 us?
How long takes Timer6_Read to execute, how did you measure it?
How did you verify that the timer didn't overflow?
How did you verify the system clocks?
How did you verify HAL_Delay accuracy?
What do RCC and TIM6 registers contain?
2020-03-04 12:29 AM
2020-03-04 10:20 AM
Yes. Tim6 frequency should be 108 MHz before prescaler. With prescaler 107 the timer should have 1 MHz count frequency (1 us period).
With 9999 as the ARR the counter should wrap around every 10 000 us = 10 ms.
BTW, which timer does HAL use? Tim7?
Also, you read the timer6 after HAL_Delay(1000), but where do you start the timer6 (or reset it)?
It should happen right before HAL_Delay, or the while before it (it shouldn't get too much off that quickly).
If the clock really runs that wrong, I'm running out of ideas.
I manually checked the clock configurations, and the only wrong thing was that PLLR was zero (bits 30-28 of PLLCFGR), when it should have been at least 2 (says the reference manual). In the clock tree it looks like it should be 2, but in the register it seemed to be 0.
2020-03-04 08:25 PM
I have check my clock frequency ,it is perfactly ok
system clock = 216 MHz , hclk clock = 216 MHz ,PCLK1= 54 MHz and PCLK2 = 108 MHz
eventhough it is not gettting 10 ms of delay
2020-03-04 09:24 PM
What I mean is that maybe tim6 has already counted so far before you start the HAL_Delay that it wraps during that delay.
Try writing zero to timer6 CNT-register just before the while-loop.
Also, what does that timer6 reading function do? If it uses printf, that may take milliseconds.
Rather, make a for-loop and make a small table of read values. Then check the table after the loop.