ADC conversion in a specific part of a internal pwm signal

cancel
Showing results for 
Search instead for 
Did you mean: 

ADC conversion in a specific part of a internal pwm signal

231 Views
jeffersonfpalhe
Contributor I

I need read my AD inputs only in a specific part of a internal pwm signal. My pwm has a period of 1 ms and initial polarity=low. I know that's possible to synchronize the AD conversion with a internal signal, I want to measure just in the high level from pwm but I don't know how to execute the measure only in a specific part of the signal. can you help me?#MK22FX512VLH12 #processorexpert

0 Kudos
1 Reply

126 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi

The FTM initialization trigger and channel triggers can be used  as PDB input trigger.
If you configure the FTM0 as Edge-Aligned PWM Low-true pulses(set Output on match), you can select FTM channel trigger.

FTM trigger PDB start ADC.png

Please refer the project attached. It is based on FRDM-K22F board with Processor Expert using KDS3.2.0.

PWM PDB ADC sample.png

The Processor Expert seems forget to configure FTMx_EXTTRIG register, so you need to manually add the following code.It is used to enable the generation of the channel trigger when the FTM counter is equal to the CnV register.

FTM_PDD_SetChannelTrigger0(FTM0_BASE_PTR,PDD_ENABLE);    /* Enable the generation of the channel trigger when the FTM counter is equal to the CnV register. */

Best Regards,

Robin

0 Kudos