AnsweredAssumed Answered

MCU running too slow?

Question asked by chichkine.ivan on May 20, 2013
Latest reply on May 23, 2013 by Clive One
So I've been noticing recently that my stm32f4 discovery board is running under 168 MHz. Or at least I think. I'm trying to get this loop
uint32_t i = 0;
for(;i<76799;i++)
    {
        GPIOD->ODR = 0x4100;
        GPIOD->ODR = 0x5100;
    }
to execute as fast as possible and I noticed that one iteration of the loop takes 143nS to complete, which is about 24 cycles @ 168 MHz. Surely comparing a 32-bit integer, writing to a register twice, and jumping back to the beginning shouldn't take 24 cycles?
If I probe PD12 (the pin that's changing), it takes about 21 nS from the time it goes low to the time it goes high again. 48MHz? What's going on here?
I've attached the system_stm32f4xx.c just in case.

EDIT: I also should have mentioned that other clocks (SPI, SDIO, TIM4) work correctly so maybe this MCU is just slower than I expected.

Attachments

Outcomes