AnsweredAssumed Answered

STM32F103 - different processing rate

Question asked by pavelm on May 12, 2014
Latest reply on May 13, 2014 by pavelm

I have a problem with different speed of processing rate while doing even trivial changes in source code.
I mean it seems as CPU is changing its clock, so for same instructions it takes significantly longer for CPU.
For example my code contains primitive delay function with NOPs. But when I add somewhere (from point of programmer - does not matter where) piece of additional code then sometimes it happen. Same source code works significantly slower (20-50%) and the rate is dependent on changes.

Strange is, I checked Clock and it is still 72Mhz. Also I've examined some options in RCC, PWR, etc, but I am unable to determine what is wrong.

I am nearly sure problem is in uninitialised memory.
It seems as such thing in CPU is reading memory from some address used for firmware.
It is enough to for example add or remove some lines in source code - if (variable), changing variable type, ... to fix slow rate but it is very tricky to fix it sometimes.
This rate is only changing when program is compiled again with such changes.

It must be memory related, since I found more issues with unitialised structures in my case.
I checked my BSS section is zeroed too.
It seems PWM rate and other interrupts are not affected even it is hardcoded to 72Mhz in init functions.

My code is based on ST StdLibrary 3.4.0, no additional changes in template.
Using Linaro GCC.

Thanks for any help