What is the minimum configuration required for a Kinetis microcontroller

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

What is the minimum configuration required for a Kinetis microcontroller

ソリューションへジャンプ
1,915件の閲覧回数
pratiekbhadrana
Contributor III

I want to build a project without using Processor Expert on KDS v2.0.0 using the MK20D64VLH7. I want to try. So naturally I would have to configure the clocks and interrupts myself. Just for the trial I have an LED and a push button. When I press the pushbutton the LED should light up after a delay of 1s. So what would be the minimum configuration required in terms of clocks, interrupts and other unknown stuff ?

Wish you a Happy New Year !!!

Thanks

ラベル(2)
0 件の賞賛
返信
1 解決策
1,609件の閲覧回数
mjbcswitzerland
Specialist V

Hi Pratiek

A minimum configuration is to run from the default clock (FEI - 20..25MHz), enable the SYSTICK and poll it and the input port (after powering up the port and ensuring that it is an input) to do what you want to do.

You will however need to disable the watchdog as very first thing after a reset by following the unlock/disable procedure.

Then you can add different clock settings and interrupts as you progress from the minimum configuration.

Regards

Mark

元の投稿で解決策を見る

0 件の賞賛
返信
8 返答(返信)
1,610件の閲覧回数
mjbcswitzerland
Specialist V

Hi Pratiek

A minimum configuration is to run from the default clock (FEI - 20..25MHz), enable the SYSTICK and poll it and the input port (after powering up the port and ensuring that it is an input) to do what you want to do.

You will however need to disable the watchdog as very first thing after a reset by following the unlock/disable procedure.

Then you can add different clock settings and interrupts as you progress from the minimum configuration.

Regards

Mark

0 件の賞賛
返信
1,609件の閲覧回数
pratiekbhadrana
Contributor III

Hi Mark, thanks a lot for your reply. I have two queries regarding your statement -

1. Why 20-25 MHz only? The device I'm using can support upto 72 MHz.

2. What exactly is the function of the SYSTICK timer? I know it is a core ARM peripheral and I went through the ref manual also, but I'm a little bit hazy as to exactly what it does.

And one more general query -

Lets say I do not initialize any other peripherals like interrupts or SPI or I do not set any specific low power modes, etc. What happens to those registers(ie the regiisters that set their operating mode). They will have some garbage value right? And won't that affect my application?

Is there any information that I should read in the ARM technical reference manual or the ARM generic devices user guide apart from Freescale's own documentation?

Thanks

0 件の賞賛
返信
1,609件の閲覧回数
mjbcswitzerland
Specialist V

Pratiek

1. The processor is running from the internal RC oscillator (20..25MHz) out of reset. If you want to run at 72 MHz system clock you will need to configure the PLL and move through the MCG state-machine acording to the documentation.

2. The SYSTICK is a counter (with interrupt and reload when it counts down to zero). You can set it to a high value and read the present count value to determine the time that has lapsed - or use its interrupt for a regular time period (Tick).

Most peripherals are disabled (not clocked) out of reset and need to be clocked (powered up) before use. Most peripherals also reset to default values that don't cause any problems to other parts of the system - if you don't initialise a peripheral it won't disturb you. You will need to spend of time/energy 99% learning about the Kinetis configuration and its peripherals and 1% learing about the Cortex M4 core. Most of the core information is in ARM documentation and not Freescale documentation.

Regards

Mark

1,609件の閲覧回数
pratiekbhadrana
Contributor III

Thanks Mark !!

Sorry to keep bothering you.

I was reading the K20 Reference Manual section on Clock Distribution. An interesting point I found was that clock frequency for the Core is different, for the Flash is different for the Ports is different. How does this work? I have only used simple 8 bitters till now, so this is something new to me. Also is it sufficient then to set only the FEI clock @ 20-25MHz and the rest takes care of itself just like the un-initialised peripherals?

0 件の賞賛
返信
1,609件の閲覧回数
paulstoffregen
Contributor III
0 件の賞賛
返信
1,609件の閲覧回数
pratiekbhadrana
Contributor III

Thanks Paul

0 件の賞賛
返信
1,609件の閲覧回数
mjbcswitzerland
Specialist V

Pratiek

If you use the default clock setting there is nothing out of range.

Once the PLL or FLL is used you have to ensure that all clocks derived from it are in range (mainly not too fast, but there are also some things that won't work correctly if the frequencies are too low).

The main settings for the clocks derived from the system clock are in SIM_CLKDIV1. Here the bus speed and the flash clocks are set from the system clock - you need to check the maximum that they are specified at for the chip in question and set the dividers accordingly.

If you use the uTasker project with the K20 it will allow you to define settings and will also warn you if anything is out or range:

KINETIS Project Code

I have posted a screen shot of a 72MHz K20 in operation in its Kinetis simulator where you can see the clock information being shown. The clocks are simulated and it is easy to step through the code to to see what is happening and experiment.

Regards

Mark

pastedImage_1.png

1,609件の閲覧回数
pratiekbhadrana
Contributor III

Thanks

0 件の賞賛
返信