Maximum K22 IRC frequency

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

Maximum K22 IRC frequency

740 Views
laszlomonda
Contributor IV

Hi there,

I'm interested about the maximum frequency of MK22FN512VLH12 purely using the IRC and PLL (without any additional components like crystal and oscillator).

Also, what settings are needed to be set to achieve that frequency?

Thanks in advance!

- Laci

6 Replies

463 Views
laszlomonda
Contributor IV

Thank you for the explanation, Mark! Makes perfect sense. Given the complications and increased power consumption of the HSRUN mode I think I'll stick to RUN mode. In any case, it's always good to be aware about such issues.

0 Kudos

463 Views
mjbcswitzerland
Specialist V

Hi

You can use the IRC48M to work at 120MHz system clock (needs to be in HSRUN mode), 60MHz bus clock and 24MHz Flash clock.

See http://www.utasker.com/kinetis/MCG.html for more details (including workaround for errata in earlier chips when using USB device)

In the uTasker project this is configured with

#define RUN_FROM_HIRC_PLL

#define EXTERNAL_CLOCK 48000000 // this is not really external but the IRC48MCLK is otherwise selected as if it were

#define _EXTERNAL_CLOCK EXTERNAL_CLOCK

#define USE_HIGH_SPEED_RUN_MODE // 120 MHz requires use of the high speed run mode (with restriction of not being able to program flash in that mode)

#define CLOCK_DIV 20 // input must be divided to 2MHz..4MHz range (/1 to /24)

#define CLOCK_MUL 50 // the PLL multiplication factor to achieve operating frequency of 120MHz (x24 to x55 possible)

#define BUS_CLOCK_DIVIDE 2 // 120/2 to give 60MHz

#define FLEX_CLOCK_DIVIDE 3 // 120/3 to give 40MHz

#define FLASH_CLOCK_DIVIDE 5 // 120/5 to give 24MHz

#define USB_CRYSTAL_LESS // use 48MHz IRC as USB source (according to Freescale AN4905 - only possible in device mode)

Regards

Mark

http://www.utasker.com/kinetis/FRDM-K22F.html

http://www.utasker.com/kinetis/TWR-K22F120M.html

http://www.utasker.com/kinetis/BLAZE_K22.html

463 Views
laszlomonda
Contributor IV

Thank you very much for the reference, Mark. Yours is an unusually thorough writeup and is very impressive. I still couldn't fully wrap my head around the MCG but it makes better sense.

Is HSRUN mode the only way to drive the MCU at 120 Mhz? Is there any other lower energy mode for 120 Mhz (possibly involving an external crystal)? If so, what value should I pick for a crystal?

Thanks again!

- Laci

0 Kudos

463 Views
mjbcswitzerland
Specialist V

Hi

The HSRUN mode allows the core and bus frequencies to operate up to the maximum speeds, whereas without it these are limited to 80MHz and 50MHz. This has nothing to do with clock sources or setting since it is purely a limitation of the maximum speeds. In fact 120MHz is usually not a problem without being in HSRUN mode but does mean that the device is being operated outside of its specification according to its data sheet, which is not advisable for product operation (only for hobby over-clocking or lab experiments).

Not all K22 parts have HSRUN mode - the particular K22 part used needs to be checked and some K22 derivatives allow 120MHz in RUN mode.

The probem with HSRUN mode is that it is not possible to perform Flash operations without first reducing the speeds and switching to normal RUN mode (as well as some other minor restrictions as detailed in the user's manual) which can cause peripherals to fail due to the speed switching needed. I am not sure about the advantages of devices with HSRUN mode (possibly their power consumption is slightly lower in RUN mode at <= 80MHz(?)) but it may be simplest to use a K22 derivative without the HSRUN mode requirement in case 120MHz is required all the time without any Flash programming restrictions.

Regards

Mark

463 Views
sreejithmenon
Contributor I

Hey Mark,

 I am using a MK22FN512CAP , which I need to get to run at 120 MHZ all the time on a commercial product.Using clock configurer in MCUpresso IDE , I have configured the HSRUN mode by using the IRC48M to run at 120MHZ.

1) the only way I could verify this is running at a core speed of 120 is by checking the flash clock using the CLKOUTSET in SIM_SOPT2 reg.It seems to be running at 24 Mhz and in accordance with the choices I made, I infer 120 MHZ core speed. Do you know a better way of verifying core clock.

2) I am confused with the disadvantages of running HSRUN mode. Is there anything I should be concerned about ?( flash write/read ? or peripherals ?).Or can/should I run it in normal run mode ???

Please advice,

0 Kudos

463 Views
mjbcswitzerland
Specialist V

Sreejith

There is no way to directly measure the flash clock speed but if you can measure a clock that is used to derive it form any you are sure of the divider value it will be quite clear what rate it has.

If you read the HSRUN chapter in the user's guide to the part that you use you will find a list of any restrictions of the mode. Usually the main one is that flash can neither be deleted nor programed when in that state.

Regards

Mark


uTasker developer and supporter (+5'000 hours experience on +60 Kinetis derivatives in +80 product developments)
Kinetis: http://www.utasker.com/kinetis.html

0 Kudos