2015-12-15 05:55 AM
Hi everybody
I am trying to implement some mathmatic calculations in STM32F103.
I use HSI and PLL to provide 64MHz and 36MHz clock, considering Flash Wait State and enabling Prefetch Buffer.
I expect that the calculation time in 64MHz should be faster that 36MHz. As I checked, in both cases, the calculation time is almost same (e.g. 110 usec).
For your information, I used the Timer counter value (e.g. Timer 1) in debug mode (DBGMCU_TIM1_STOP enabled) to calculate the time required for calculation processes.
I use the following method to find the calcuation time:
I inserted one break point exactly before first line of mathematics processes and one break point exactly after them.
When the execution of my code is stopped at first break point I record the Timer 1 counter value (e.g. C1=1000).
Then in second break point, I again record the counter value (e.g. C2=8000).
Then I calculate the time by:
(C2-C1)*(1+Tim1Prescaler)/Tim1ClockFrequency=(7000*(1+0)/64MHz)=109 usec.
Each instruction need some clock cycles to do calculations. Therefore, I expect that if the frequency of Clock is increased, then that instruction will be calculated faster. Am I right?
2015-12-15 08:11 AM
[DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/Calculation%20time%20is%20same%20in%20both%2036MHz%20and%2064MHz%20clock&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/STM32Java/AllItems.aspx¤tviews=17]Dupe