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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

839 Views
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 Kudos
2 Replies

825 Views
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 Kudos

820 Views
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 Kudos