What's the clock frequency of MPC5668G when debugging?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What's the clock frequency of MPC5668G when debugging?

565 Views
GangHan
Contributor I

Platform: MPC5668GKITJ evaluation board

IDE: CodeWarrior MCU 10.2

Debugger: USB Multilink Interface

 

In debug mode, I downloaded the code into MPC5668G e200z6 and run it.  But the execution time of 1760 instructions is 250us. The manual says the frequency is static to 116MHz. Then, the average CPI (cycles per instruction) is more than 16! It can't be true!

 

So, what's the system clock of MPC5668G in debug mode? Is it clocked by the debugger?

 

Thanks in advance,

Gang

Tags (1)
0 Kudos
Reply
1 Reply

436 Views
TomE
Specialist II

> Then, the average CPI (cycles per instruction) is more than 16! It can't be true!

 

Obviously it is true.

 

These are not simple chips. I was on a project, and the first time we got our MPC up and running it was a lot slower than our previous 68000 based product (very long time ago with an MPC860). The chip defaulted into a "serialised execution mode" to support debugging (your one doesn't seem to do that) and was slowed down by very slow memory accesses for instruciton fetch.

 

Short answer - you have to enable the cache to get the CPU running at one instruction per clock. That usually requires the MMU to be set up first to designate cacheable and no-cacheable regions. This can be very complicated to get right.

 

Longer answer. Are you running code from FLASH or RAM? RAM can give you up to 2 wait states for accesses.

 

If you're running from FLASH, have you reprogrammed PFCRPn? FLASH defaults to no prefetch, no pipelining, no line read buffers and 7 wait states on top of "best case access".


To check your real clock speed, set up a timer (STM) and write some code to report (by flashing a LED or something) how fast it is counting. Otherwise the CPU has an inbuilt counter register you can use for the same purpose.

 

Try running some code out of RAM and see how fast it is. Try to find some working code that sets up all the clocking, FLASH and RAM configuration, MMU and cache. You don't want to have to try and write all this yourself.

 

Tom

 

0 Kudos
Reply