i.MX7 M4 low clock speed

Good day,

For the past few days I’ve been scratching my head over the following:
We’re developing a system using the i.MX7 on the Colibri mounted on the Aster V1.1B board and I’m currently responsible for the (bare metal) M4 part of the system. So, as a starter, I got to driving the one user LED on the Aster board, using Keil µVision 5 with the appropriate package(s).

The program of choice is very simple: A loop that counts up a variable, turning on the LED at half of max value and back off at max value and reset variable. Loading the firmware off of an SD-card via U-Boot and starting the M4 using bootaux ${loadaddr} (not starting any linux component).
Initially I thought it didn’t work until at one point I had left it running while I investigated until after 9(!) minutes I found the LED had switched on, and switched back off after another ~9 minutes.
The thing is, the max value at this point was set to the SystemCoreClock.
I’ve now set it to count to one million (1e6) and it’s blinking at about 0.6Hz which, looking at the disassembly, works out to at best 12,5MHz.

The init is just this + GPIO, all from the library pack:


/* Board specific RDC settings */

/* Board specific clock settings */

U-Boot is telling me PLL_SYS is 480MHz and the ref manual is telling me the M4 core should be PLL_SYS/2 by default, which is also what the BOARD_ClockInit() seems to go for.

Have I missed something? Have I skipped a step?

Ideally, I’d look at the registers with the debugger but connecting the JLink is giving me some trouble at the moment, disrupting the running program.

Greetings @mvz!

Did you make sure to use the TCM as the memory for your application? Using any other memory such as the OCRAM or DDR will heavily affect performance.

I can’t particularly reproduce your issue with Keil uVision. Can you give it a try using the bundled cmake/gcc build system?