Hi Prasanna,
For what I could see in your code ,you need to enable the channels need it to use.
void ADC_Configuration()
{
EnableIRQ(ADC0_IRQn);
adc16_config_t adc16ConfigStruct;
adc16_channel_config_t adc16ChannelConfigStruct;
ADC16_GetDefaultConfig(&adc16ConfigStruct);
adc16ConfigStruct.clockSource = kADC16_ClockSourceAlt0;
adc16ConfigStruct.clockDivider = kADC16_ClockDivider2;
ADC16_Init( ADC0, &adc16ConfigStruct);
ADC16_DoAutoCalibration( ADC0 );
ADC16_EnableHardwareTrigger(ADC0, false);
ADC16_EnableDMA( ADC0, true);
adc16ChannelConfigStruct.channelNumber = g_ADC_mux[0];
adc16ChannelConfigStruct.enableInterruptOnConversionCompleted = true;
adc16ChannelConfigStruct.enableDifferentialConversion = false;
ADC16_SetChannelConfig( ADC0, 0, &adc16ChannelConfigStruct);
adc16ChannelConfigStruct.channelNumber = g_ADC_mux[1];
adc16ChannelConfigStruct.enableInterruptOnConversionCompleted = false;
adc16ChannelConfigStruct.enableDifferentialConversion = false;
ADC16_SetChannelConfig( ADC0, 0, &adc16ChannelConfigStruct);
adc16ChannelConfigStruct.channelNumber = g_ADC_mux[2];
adc16ChannelConfigStruct.enableInterruptOnConversionCompleted = false;
adc16ChannelConfigStruct.enableDifferentialConversion = false;
ADC16_SetChannelConfig( ADC0, 0, &adc16ChannelConfigStruct);
}
And in the interruption you only need to start a single transfer, this is the reason the interruption is trigger twice:
void BOARD_FTM_HANDLER(void)
{
FTM_ClearStatusFlags(BOARD_FTM_BASEADDR, kFTM_TimeOverflowFlag);
EDMA_StartTransfer(&g_EDMA_Handle_1);
GPIO_PortToggle(TEST_PIN_PORT, 1u << TEST_PIN_NUMBER);
__DSB();
}
For the shift in the register, I'm still looking for this.
Best Regards,
Alexis Andalon