AnsweredAssumed Answered

K20D50 - Toggle IO pin max speed

Question asked by Paulo Louro on Aug 30, 2013
Latest reply on Sep 2, 2013 by Hui_Ma

Hi

 

What is the max frequency i can toggle an IO pin using the MK20DX128 with 8Mhz crystal and PLL enabled to output 50Mhz?

 

I have used the ProcesssorExpert to configure the clock settings  and i got the following configuration output:

Core clock: 50Mhz

Bus clock: 50Mhz

External bus close: 50Mhz

Flash clock 25Mhz

 

I wrote the code bellow for testing, but according with my scope the toggling frequency is only  3.571Mhz. From the disassembly i can see that 4 instructions are needed to toggle the pin, that makes the core speed at 4 * 2 * 3.571Mhz = 28.568Mhz??? 

 

while(1)

    {

//RED_TOGGLE;
GPIOC_PTOR = 8;
GPIOC_PTOR = 8;
GPIOC_PTOR = 8;
GPIOC_PTOR = 8;
}

 

Regards,

Paulo

Outcomes