K32L2B21: Timer--Input Capture(Counter Reload On Trigger)

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

K32L2B21: Timer--Input Capture(Counter Reload On Trigger)

899件の閲覧回数
rodger_an
Contributor I

Hello,

I encounter a issue. When I initialize timer with "config->enableReloadOnTrigger = true;".

But in fact when a rising or falling edge is detected on the selected trigger input., the TPM counter will not reload with 0. 

Do you know what should I configure?

rodger_an_0-1641525667386.png

 

 

0 件の賞賛
返信
2 返答(返信)

885件の閲覧回数
jingpan
NXP TechSupport
NXP TechSupport

Hi @rodger_an ,

Please check if 

1. The trig pin is set to right function.

2. Please check TPMx_CONF[TRGSEL], [TRGSRC] and TRGPOL is correct.

3. The trigger input is ignored if the TPM counter is paused during debug mode or doze mode. This field
should only be changed when the TPM counter is disabled.

 

Regards,

Jing

0 件の賞賛
返信

880件の閲覧回数
rodger_an
Contributor I

Hi jingpan,

1. The trig pin is set to right function.

2. Please check TPMx_CONF[TRGSEL], [TRGSRC] and TRGPOL is correct.

This two item should be correct.

Because right now I reset CNT to 0 when interrupt happen, I can capture a fixed CNT value when the duty of input signal is fixed, also I calculate the time depended on timer frequency and CNT value, it is same with the period of waveform.

void TPM0_IRQHandler(void)
{
TPM0->CNT = 0; //reset counter
TPM_ClearStatusFlags(TPM0,kTPM_Chnl0Flag);
}

 

3. The trigger input is ignored if the TPM counter is paused during debug mode or doze mode. This field
should only be changed when the TPM counter is disabled.

I change this field before starting timer. 

0 件の賞賛
返信