AnsweredAssumed Answered

K20 VREF_OUT Never Stabilizes

Question asked by Ben Atkinson on May 8, 2013
Latest reply on Jun 6, 2013 by Ben Atkinson

I have a custom board with an MK20DX256VLK10.  We are trying to use a single-ended line on ADC0 to measure a voltage with respect to the VREF_OUT pin.  We want to use the mode where VREF_OUT is a 1.2V output from the K20.


My issue is that the VREF_SCVREFST_MASK bit never goes HIGH in the VREF_SC register.


I use the following MQX code to try to initialize the VREF module.  I've confirmed the VREFST bit is LOW from the CodeWarrior debugger.  The VREF_OUT pin on the K20 has a 100 nF capacity between it and GND as required by the Reference Manual.  I've tried cranking out the delay loop to 500 ms, but I still get the same result.


Please help.  Am I doing something incorrect here?







boolean EnableVRefAlt (void)


   int32_t         iReturn;

   boolean        returnValue;                                 // Return value from this function.

   const int32_t  VOLTAGE_STABLE_MS = 10;    // Milliseconds to wait for the VREF_OUT voltage to

                                                                         //    stabilize.


   // Make sure the clock is turned on to the K20 VREF module.




   returnValue = FALSE;


   // Wait for the voltage to stabilize.

   for (iReturn = 0; iReturn < VOLTAGE_STABLE_MS; ++iReturn)




         returnValue = TRUE;







   if (! returnValue)

      printf("After %d ms, VREF voltage is not stable, VREF_SC = 0x%X.\n", iReturn, VREF_SC);


   return returnValue;