Hi,
I have chosen MK60DN256ZVLL10 for my design and I have a problem with ADC (with both ADCs)
When I set input channel between 0 and 0x1C (including internal temp sensor) the result of the ADC is zero or random
(On channels 0 ~ 23 i get 0 or random values depending on MUXSEL setup and temperature sensor channel result is always random :smileyshocked: )
I get non zero (and correct) results only when i choose REFLH or Bandgap channels.
I tried Processor expert ADC component, Init_ADC component and code written by myself only (same behavior)
I tried all possible configurations of conversion modes, sampling timing, sampling time and calibrating feature.
Voltage on VREFH pin is correct (3.5 V) and voltage on pins that I would like to measure is correct and without any noise too.
List of pins that I use for measurement:
HUMIDITY | => PTC2/SPI0_PCS2/UART1_CTS_b/FTM0_CH1/FB_AD12/ADC0_SE4b/CMP1_IN0/TSI0_CH15 [72] |
BAT_MEAS | => PTE0/SPI1_PCS1/UART1_TX/SDHC0_D1/I2C1_SDA/ADC1_SE4a [1] |
PROX_MEAS | => PTB1/I2C0_SDA/FTM1_CH1/RMII0_MDC/MII0_MDC/FTM1_QD_PHB/ADC0_SE9/ADC1_SE9/TSI0_CH6 [54] |
PWRSRC_MEAS | => PTC1/SPI0_PCS3/UART1_RTS_b/FTM0_CH0/FB_AD13/ADC0_SE15/TSI0_CH14 [71] |
//enable bandgap
PMC_REGSC |= PMC_REGSC_BGBE_MASK;
//Processor Expert Init
AD0_Init();
AD1_Init();
//Calibration
ADC0_SC3 |= 0x80;
while ((ADC0_SC1A && 0x80) == 0);
ADC1_SC3 |= 0x80;
while ((ADC1_SC1A && 0x80) == 0);
for(;;)
{
ADC1_SC1A = 4;
while ((ADC1_SC1A && 0x80) == 0);
bat = ADC1_RA;
ADC0_SC1A = 15;
while ((ADC0_SC1A && 0x80) == 0);
pwr = ADC0_RA;
ADC0_SC1A = 9;
while ((ADC0_SC1A && 0x80) == 0);
prox = ADC0_RA;
ADC0_SC1A = 4;
while ((ADC0_SC1A && 0x80) == 0);
hum = ADC0_RA;
FRTOS1_vTaskDelay(500/portTICK_RATE_MS);
}