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.