Default clock frequency for KL25 in CodeWarrior

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

Default clock frequency for KL25 in CodeWarrior

Jump to solution
2,583 Views
quevedo
Contributor V

Hello,

I have started using FRDM-KL25 boards on an undergrad lab course, and in this course we use CodeWarrior 10.4, but we do not use Processor Expert. I would like to know the default clock mode and frequency that a bare metal, non-PE project configures into the KL25 microcontroller.

Thanks in advance

Labels (1)
0 Kudos
1 Solution
1,527 Views
quevedo
Contributor V

I finally got it! I have done a test using a timer to toggle an output pin, and connected my logic analyser to this pin, measuring high and low times. I have programmed the timer prescaler to divide by 128, which would give us a timer clock frequency of 160kHz, if original system clock is the expected 20.84MHz. Using a timer module of 160, I should have one toggle every 1ms, which I confirmed in my measurements. Thus, I conclude that bare metal projects without Processor Expert, in CW10.4, for KL25 processor, keeps the default clock source: FEI mode, system frequency of 20.48MHz.

View solution in original post

0 Kudos
5 Replies
1,527 Views
rogerfl
Contributor III

On reset, the mcu uses the slow internal reference clock until you configure something else.  That's 32 kHz.

1,527 Views
quevedo
Contributor V

I have verified the default reset values for the registers of the MCG module. According to that, after reset it enters FEI mode, using the 32kHz internal reference, multiplied by FLL by a factor of 640, which leads to 20.48MHz.

I still have one thing to verify. I do not know if the default startup code added by CodeWarrior in a non-PE project modifies any of the default parameters, changing clock frequency. My bet is that the startup code does not handle hardware too much, so it must keep default values. I think I will program a TPM channel to output compare and check the output frequency, relating it with the internal system clock.

0 Kudos
1,527 Views
emmanuelballest
Contributor III

Hi Antonio

if you're using your FRDM-KL25 boards with the settings used by defaul the internal oscillator 32KHz FLL.. The frequency defaul is of 20.9MHZ. Important to see that setup is if (FEI ENgaged Internal clock mode) or (FBI Bypassed Internal clock mode). you can check this:

MCG.png

1,528 Views
quevedo
Contributor V

I finally got it! I have done a test using a timer to toggle an output pin, and connected my logic analyser to this pin, measuring high and low times. I have programmed the timer prescaler to divide by 128, which would give us a timer clock frequency of 160kHz, if original system clock is the expected 20.84MHz. Using a timer module of 160, I should have one toggle every 1ms, which I confirmed in my measurements. Thus, I conclude that bare metal projects without Processor Expert, in CW10.4, for KL25 processor, keeps the default clock source: FEI mode, system frequency of 20.48MHz.

0 Kudos
1,527 Views
emmanuelballest
Contributor III

That´s right¡

0 Kudos