2020-09-09 05:23 AM
I have an issue with STM32F427 where after doing reset for MCU in some cases the MCU is running at about half the speed after reset. All peripheral clock seem to be running at normal speed, but the MCU is just running at half the speed. All register values are identical to case where it runs at normal speed. Doing a full power cycle reset fixes the issue always.
Any ideas what could slow down the MCU? Can I trust that the RCC register values show the clocks that are in use?
2020-09-09 05:27 AM
> MCU is just running at half the speed
How do you know?
JW
2020-09-09 05:29 AM
Given that peripherals are clocked off of the system clock, I don't see how this would be possible. Perhaps you can explain more why you think it's the case.
Yes the RCC registers can be trusted.
2020-09-09 05:34 AM
There's for example some LEDs blinking that blink at half speed. They rely on SysTick. Also there's some instrumentation for checking how much time the code takes to run, and it's roughly doubled. Also some functionality starts giving overflows, because the processing cannot handle everything in time.
2020-09-09 05:39 AM
I mean RCC registers (and all others) are identical in cases where MCU is running normally or slowly. I'm just wondering could for example the bit showing that RCC_BDCR->HSERDY or other bits there show wrong status after reset..
The errata also mentions quite vaguely about something about delay needed after clock enabling, but I don't know how that's supposed to affect.
2.2.6 Delay after an RCC peripheral clock enabling
2020-09-09 10:12 AM
> There's for example some LEDs blinking that blink at half speed. They rely on SysTick.
> Also there's some instrumentation for checking how much time the code takes to run, and it's roughly doubled.
> Also some functionality starts giving overflows, because the processing cannot handle everything in time.
May be also processor exhaustion due to excessive interrupts, or any other resource starvation.
Try to remove parts of your program, one by one, to find out which one causes this effect.
JW
2020-09-09 10:40 PM
Unfortunately it's quite difficult to remove most of the parts of code. I've done it for some parts and had no luck.
I guess there is no easy way of instrumenting how often interrupts happen... Going through all interrupts guessing what might help is just going to take immense amount of effort and the fault might not even be there.
I don't think it's resource starvation, because it happens in all parts of the program that run very different code.
2020-09-10 05:15 AM
> I guess there is no easy way of instrumenting how often interrupts happen
Typically this is done by flipping a bit high during the ISR, and returning it low when it exits. This lets you view it very easily on a scope.
2020-09-10 05:27 AM
Sure, it's easy for one. But when you have all the interrupts on the MCU to check...
2020-09-10 05:42 AM
> But when you have all the interrupts on the MCU to check...
Then what? Two lines of code per relevant interrupt seems a very doable task to me.
You have to realize that saying the cpu slows down and yet all peripherals retain their same speed is a pretty wild claim. That's just not supported by how the architecture is built.