2012-03-30 01:17 AM
How can I configure
the
Port A
prescaler
to read
every 5
seconds.
What is the
formula
that is used
?
Is there a
document that explains how
I set
the timers
?
2012-03-30 05:50 AM
I've always found reading the TECHNICAL MANUALS to be quite adequate
Where TIM_TimeBaseStructure.TIM_Prescaler = X - 1; TIM_TimeBaseStructure.TIM_Period = Y - 1; UpdateRate = (TIMCLK / X) / Y; For 5 Seconds, and 72 MHZ, you must factor 72000000 * 5 into two 16-bit values (ie less than 65536) = 5 * 72000000 = 360000000 = 36000 * 10000 Prescale = 36000 - 1; Period = 10000 - 1;2012-03-30 09:05 AM
The TIMClK is the value of the Sysclock or AHPB1 stm32f4discovery?
Then the prescaler must always be less than 65536 right. When we multiply 5 * 72000000 = 360000000 which means?2012-03-30 09:39 AM
TIMCLK will depend on which TIM you use, and the clock settings on your system. I assumed 72 MHz based on how the STM32F1xx chips work.
On an STM32F4 it's presumably 168 MHz or 84 MHz. And you also have a couple of 32-bit period counters. Assuming 5 seconds at 168 MHz, we have = 5 * 168000000 = 42000 * 20000 I don't presume to know what settings you have, refer to the clock tree and settings. You are trying to count the number of clock ticks over 5 seconds. Realistically you could have the interrupt at a more frequent rate, and then count off 5 seconds.2012-03-30 09:55 AM
thank you
I'll try to implement