ADC hardware trigger using FTM on KV30

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

ADC hardware trigger using FTM on KV30

521 Views
christianlees
Contributor III

I can't seem to get the ADC on a KV30 to hardware trigger.  I have tried various clock settings, the surrent setting allow it to software trigger.  I have in interrupt on ADC completion so I can tell if it is working.  The end goal is to use DMA for scan three channels.  The application is a Bidirectional DCDC converter based on a a pair of TI LM5170.  The bus clock is 48MHz.

I can't seem to find any documentation that say the ADC can't be triggered from FTM1.

Any assistance would be appreciated.

#define ADC_PERIOD 10000U // in uS
#define ADC_FTM_BASEADDR FTM1
#define ADC_FTM_SOURCE_CLOCK (CLOCK_GetFreq(kCLOCK_BusClk)/16)

adc16_config_t adc16ConfigStruct;
adc16_channel_config_t adc16ChannelConfigStruct;
ADC16_GetDefaultConfig(&adc16ConfigStruct);

adc16ConfigStruct.referenceVoltageSource = kADC16_ReferenceVoltageSourceVref;
adc16ConfigStruct.clockSource = kADC16_ClockSourceAlt0;
adc16ConfigStruct.enableAsynchronousClock = false;
adc16ConfigStruct.clockDivider = kADC16_ClockDivider4;
adc16ConfigStruct.resolution = kADC16_ResolutionSE12Bit;
adc16ConfigStruct.longSampleMode = kADC16_LongSampleDisabled;
adc16ConfigStruct.enableHighSpeed = true;
adc16ConfigStruct.enableLowPower = false;
adc16ConfigStruct.enableContinuousConversion = false;

ADC16_Init( ADC0, &adc16ConfigStruct);

ADC16_DoAutoCalibration( ADC0 );

ADC16_EnableHardwareTrigger( ADC0, true);

adc16ChannelConfigStruct.channelNumber = ADC_mux[0];
adc16ChannelConfigStruct.enableDifferentialConversion = false;

ADC16_SetChannelConfig( ADC0, 0, &adc16ChannelConfigStruct);

ftm_config_t ftm_info;
FTM_GetDefaultConfig(&ftm_info);
ftm_info.prescale = kFTM_Prescale_Divide_16;
FTM_Init(ADC_FTM_BASEADDR, &ftm_info);
FTM_EnableInterrupts(ADC_FTM_BASEADDR, kFTM_TimeOverflowInterruptEnable);
FTM_SetTimerPeriod(ADC_FTM_BASEADDR, USEC_TO_COUNT(ADC_PERIOD, ADC_FTM_SOURCE_CLOCK));

SIM->SOPT7 = 0X89; 

FTM_StartTimer(ADC_FTM_BASEADDR, kFTM_SystemClock);

0 Kudos
1 Reply

343 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

It seems that you forget to enable the generation of the trigger when the FTM counter is equal to the CNTIN register:

FTM1->EXTTRIG |=FTM_EXTTRIG_INITTRIGEN_MASK;

Best Regards,

Robin

 

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos