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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,046 次查看
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 回复数

1,032 次查看
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 项奖励
回复

1,027 次查看
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 项奖励
回复