I am getting confused or rather my understanding is improper about the channel group.
I have configured my project using KDS 3.0 with KSDK 1.2.0 with FSL_ADC as one of the component. I have generated the code and trying to read the data on the pin.
// Software trigger the conversion. ADC16_DRV_ConfigConvChn(FSL_ADCONVVM, ADC16_CHN_GROUP0, &adConvVM_ChnConfig0); // Wait for the conversion to be done. ADC16_DRV_WaitConvDone(FSL_ADCONVVM, ADC16_CHN_GROUP0); // Fetch the conversion value. VoltageLevel = ADC16_DRV_GetConvValueSigned(FSL_ADCONVVM, ADC16_CHN_GROUP0); printf("Read 12V DAC Value %d\r\n",VoltageLevel);
Now, ADC16_CHN_GROUP0 is the what I have defined as 0 assuming the ADC0 being ADC channel group 0 and ADC channel group 1 to be ADC1.
I am always getting a value of 255 when I read the data on any of the pins. Why did the generated code does not have a define for channel group. Am i using the driver functions properly.
to describe a little more on the voltage measuring input. my Vref is given 3 V and the 12V source is given to ADC0_DP0 using voltage divider and limited within 3V.
Thanks,
Kewal
Solved! Go to Solution.
Hello Kewal.
In the function
adc16_status_t ADC16_DRV_ConfigConvChn ( uint32_t instance, uint32_t chnGroup, const adc16_chn_config_t configPtr )
The fisrt parameter "instance" is the ADC16 instance ID, that is the ADC0 ADC1 ...
The seconde parameter "chnGroup" is the Selection of the configuration group, that is ADC0_A ADC0_B .
Hope it helps
Have a great day,
Alice Yang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Kewal.
In the function
adc16_status_t ADC16_DRV_ConfigConvChn ( uint32_t instance, uint32_t chnGroup, const adc16_chn_config_t configPtr )
The fisrt parameter "instance" is the ADC16 instance ID, that is the ADC0 ADC1 ...
The seconde parameter "chnGroup" is the Selection of the configuration group, that is ADC0_A ADC0_B .
Hope it helps
Have a great day,
Alice Yang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------