I'm using multiple AD channels of the s32k144 MCU, but only one of them reads. Below is my code. What can I do to resolve this?
//ADC1_SE1
/* Configure the ADC converter - See ADC component for the configuration details */
ADC_DRV_ConfigConverter(ADC_INSTANCE1, &adConv2_ConvConfig0);
/* Configure ADC channel and software trigger a conversion */
ADC_DRV_ConfigChan(ADC_INSTANCE1, ADC_CHN1, &adConv2_ChnConfig1);
/* Wait for the conversion to be done */
ADC_DRV_WaitConvDone(ADC_INSTANCE1);
/* Store the channel result into a local variable */
ADC_DRV_GetChanResult(ADC_INSTANCE1, ADC_CHN1, &valorAD);
//ADC1_SE2
/* Configure the ADC converter - See ADC component for the configuration details */
ADC_DRV_ConfigConverter(ADC_INSTANCE1, &adConv2_ConvConfig0);
/* Configure ADC channel and software trigger a conversion */
ADC_DRV_ConfigChan(ADC_INSTANCE1, ADC_CHN2, &adConv2_ChnConfig2);
/* Wait for the conversion to be done */
ADC_DRV_WaitConvDone(ADC_INSTANCE1);
/* Store the channel result into a local variable */
ADC_DRV_GetChanResult(ADC_INSTANCE1, ADC_CHN2, &valorAD);
//ADC1_SE0
/* Configure the ADC converter - See ADC component for the configuration details */
ADC_DRV_ConfigConverter(ADC_INSTANCE1, &adConv2_ConvConfig0);
/* Configure ADC channel and software trigger a conversion */
ADC_DRV_ConfigChan(ADC_INSTANCE1, ADC_CHN0, &adConv2_ChnConfig0);
/* Wait for the conversion to be done */
ADC_DRV_WaitConvDone(ADC_INSTANCE1);
/* Store the channel result into a local variable */
ADC_DRV_GetChanResult(ADC_INSTANCE1, ADC_CHN0, &valorAD);
I only can read valorAD in ADC1_SE0...
Hello,
I would like to recommend you to look at S32K1xx ADC guidelines, spec and configuration
https://www.nxp.com/docs/en/application-note/AN12217.pdf
Only SC1A can be used for software trigger mode.
Instead of ADC_CHNx should be always '0'.
For example, see the configuration below:
/* Configure ADC channel and software trigger a conversion */
ADC_DRV_ConfigChan(ADC_INSTANCE, 0U, &adConv1_ChnConfig0);
There is a possibility to choose the input (SC1A[ADCH]).
You can refer to adc_swtrigger_S32k144 SDK example.
I hope it helps you.
Best Regards,
Diana