ADC Conversion value not responding to analog input

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

ADC Conversion value not responding to analog input

1,237件の閲覧回数
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.

ラベル(1)
タグ(2)
0 件の賞賛
返信
1 返信

1,057件の閲覧回数
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 件の賞賛
返信