AnsweredAssumed Answered

K22F ADC operation at very low temperatures

Question asked by whata on Jan 14, 2020
Latest reply on Jan 17, 2020 by Kerry Zhou

Hi, 

 

I'm using MK22FN512VLH12 at pretty low temperatures, typically -30 deg Celsius and it seems that device can get stuck while polling kADC16_ChannelConversionDoneFlag. 

 

My setup is as follows:

 

void adc_init (void)
{
    ADC16_GetDefaultConfig(&adc_cfg);

    adc_cfg.referenceVoltageSource = kADC16_ReferenceVoltageSourceVref;
    adc_cfg.enableLowPower = true;
    adc_cfg.longSampleMode = kADC16_LongSampleCycle24;
    adc_cfg.resolution = kADC16_Resolution16Bit;

    ADC16_Init (ADC0, &adc_cfg);
    ADC16_EnableHardwareTrigger(ADC0, false);
    ADC16_DoAutoCalibration (ADC0);
    ADC16_SetHardwareAverage(ADC0, kADC16_HardwareAverageCount32);
}

uint32_t adc_get (uint32_t channel)
{
    chan.channelNumber = channel;
    chan.enableDifferentialConversion = false;
    chan.enableInterruptOnConversionCompleted = false;

    ADC16_SetChannelConfig (ADC0, 0, &chan);

    while ((kADC16_ChannelConversionDoneFlag &
            ADC16_GetChannelStatusFlags(ADC0, 0)) == 0);

    return ADC16_GetChannelConversionValue(ADC0, 0);

}

 

Lockup occurs while polling the flag at line 24. Warming device back to normal ambient temperature (~23) and manually setting setting flag seems to resolve this issue. I can obviously introduce a timeout feature, but I wanted to hear out any suggestions first.

Outcomes