Using CMP to compare 2 analog inputs + capturing a FTM counter value

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

Using CMP to compare 2 analog inputs + capturing a FTM counter value

ソリューションへジャンプ
1,770件の閲覧回数
riglesias
Contributor II

Hi, I want to configure the CMP to compare 2 analog inputs and capture a counter value depending on the comparator output, so i did the following:

1.On one hand, i know how to setup the CMP module and trigger an interrupt / put the result in CMP0_OUT.

2. On the other hand, i know how to set the FTM module (counter) in single edge capture mode to capture the counter value given a configured input.

And now, I want to mix these two things together and capture the FTM counter value when the CMP0_OUT is set.

I know that i can set FTM as a trigger source for CMP0_OUT, using TRGMUX like this:

TRGMUX->TRGMUXn[TRGMUX_FTM0_INDEX] = TRGMUX_TRGMUXn_SEL0(0x0E);
// 0x0E corresponds to CMP0_OUT
 
but i dont know if i need to do something more, or if this is the correct path to follow to do what i need to do, so im posting this question in case somebody can give any tips on how to to this in a proper way.
 
Thanks!!

 

0 件の賞賛
返信
1 解決策
1,758件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,
If you want to capture the FTM CNT value on an active edge of the CMP0_OUT trigger signal, you can use SIM_FTMOPT1[FTM2CH0SEL, FTM1CH0SEL] to select CMP0_OUT instead of the FTM2_CH0 input, FTM1_CH0 input.
So, the CMP0_OUT signal will be the FTM IC input signal of the corresponding channel.
FTM0 does not support the feature though.

danielmartynek_0-1610100433345.png

Regards,

Daniel

元の投稿で解決策を見る

2 返答(返信)
1,737件の閲覧回数
riglesias
Contributor II

Thanks for the reply

0 件の賞賛
返信
1,759件の閲覧回数
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,
If you want to capture the FTM CNT value on an active edge of the CMP0_OUT trigger signal, you can use SIM_FTMOPT1[FTM2CH0SEL, FTM1CH0SEL] to select CMP0_OUT instead of the FTM2_CH0 input, FTM1_CH0 input.
So, the CMP0_OUT signal will be the FTM IC input signal of the corresponding channel.
FTM0 does not support the feature though.

danielmartynek_0-1610100433345.png

Regards,

Daniel