ADC Conversion value not responding to analog input

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

ADC Conversion value not responding to analog input

595 Views
gauravbanyal
Contributor IV

Hello,

I am using the part MKL03Z32VFG4.

On this, I am using the ADC module to measure battery voltage. I am using pin PTA0 as my analog measurement pin. Following is my pin mux setting.

PORT_SetPinMux(PORTA, PIN0_IDX, kPORT_PinDisabledOrAnalog); /* PORTA0 (pin 14) is configured as ADC0_SE15 */

I am using a variable power supply to check the variability of the ADC reading with the changing voltage. I am using the ADC in software trigger as described in the SDK example "SDK_2.2_MKL03Z32xxx4\boards\frdmkl03z\driver_examples\adc16\interrupt".

Problem is: I am always getting the same values no matter what voltage I supply to that pin. 

Please help me with what could be the problem.

Additional question. Are these values correct since I am using PTA0 pin for measurement? I don't understand quite well the "CHANNEL_GROUP" constant. But I notice that when I use any value other than '0U' for CHANNEL_GROUP, the conversion complete interrupt is never triggered.

#define BATT_ADC16_BASE ADC0
#define BATT_ADC16_CHANNEL_GROUP 0U
#define BATT_ADC16_USER_CHANNEL 15U /* PTA0, ADC0_SE15 */

Please help on priority.

Labels (1)
Tags (2)
0 Kudos
1 Reply

415 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Gaurav Banyal

I have made the same changed as you and I could run the example without problems. Please consider that if you going to use PTA0 as analog pin, you won't be able to debug your program, because this pin is the SWD_CLK pin, which is used in the debug communication.

About the Channel Group, this is for the Result, some Kinetis has the possibility to select between ADCx_RA and ADCx_RB, so when you get the conversion value you have  base->R[channelGroup]; For KL03 you only have Group 0.

Hope this information could help you.

Best Regards

Jorge Alcala

0 Kudos