Ftm problem with k12d ucontroller

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

Ftm problem with k12d ucontroller

807件の閲覧回数
matteocivale
Contributor II

Hello to everyone,

i have a strange problem with a kinetis k12d microcontrollers,  i'm  trying to configure   FTM0 peripherals with a desiderate frequency of 1kHz, to check correct frequency settings  i toggle a pin in the FTM0 interrupt function and see it with oscilloscope. the result is a wrong frequency of 135 kHz, this may be due to wrong settings of MOD and PRESCALER register  but i noted that if i change them the frequency result don't change  the output frequency looks like indipendent of MOD and PRESCALER settings. I set the FTM0 as follow:

  SIM_SCGC6|=SIM_SCGC6_FTM0_MASK;

  FTM0_CNTIN = FTM_CNTIN_INIT(0);

  FTM0_MOD= 10000 - 1;

  FTM0_SC|= FTM_SC_TOIE_MASK | FTM_SC_CLKS(1)|

                       FTM_SC_PS(0) | FTM_SC_TOIE_MASK;

I set the bus frequency to 25 Mhz

have someone some idea about the problem ?

thank you

ラベル(1)
0 件の賞賛
3 返答(返信)

559件の閲覧回数
matteocivale
Contributor II

I forget  an  imporatant things, to test that the bus freqency is correct, i try to set the pin tooggle at 1 khz by setting the PIT frequency and it work ok. 

0 件の賞賛

559件の閲覧回数
isaacavila
NXP Employee
NXP Employee

Hello Matteo,

I don't know what other things you are doing during your project, but it seems rare that any change on MOD register does not impact the timing period for the pin that you are toggling, however, I was able to create a basic project for FRDM-K20D50M which uses a MK20D50 MCU which is compatible with MK12DX.

I am attaching this basic project (maybe it serves you as guidance) and also I am adding an image that shows a 1-kHz toggling frequency.

FTM Output.jpg

Hope this helps!

Regards,

Isaac

559件の閲覧回数
matteocivale
Contributor II

Thank you :smileywink:

0 件の賞賛