I am trying to read a voltage at pin 3 off of a mkl17z64 32QFN package. that is PTE16 and the ADC channel is ADC0_SE1.
VDDA is connected to 3.3V.
VSSA is connected to GND.
I enabled ADC0 in SIM.
I configured PortE pin 16 to ALT 0 which is ADC0_SE1.
I configured the registers in the ADC are set to
CFG1 = 0x71
CFG2 = 0
SC2 = 0
SC3 = 0
PG = 0x8000
MG = 0x8000
Then is set
SC1A = 0x01
I wait til the SC1A[COCO] is set to say the conversion is done.
The result from the conversion is FF if the voltage is greater then 0V even if it is 0.013V
The result from the conversion is 00 if the voltage is less then 0V even if it is -0.004V
Is there some thing i am miss or forget to enable.