I want to use the internal bandgap voltage as a reference voltage for the internal ADC.
I activate the band gap like this:
VREF->SC = VREF_SC_VREFEN_MASK | VREF_SC_REGEN_MASK | VREF_SC_MODE_LV(2);
while ((VREF->SC & VREF_SC_VREFST_MASK) == 0); // Wait for the bandgap ref to activate
I use VREF_SC_MODE_LV(2) because my debugger (KEIL) says that 2 = Tight regulation buffer enabled.
0 = Bandgap on only, for stabilization and startup
1 = Reserved
2 = Tight regulation buffer enabled
3 = Reserved
But the reference manual says:
00 Bandgap on only, for stabilization and startup
01 High-power buffer enabled
It does not work if i select VREF_SC_MODE_LV(1) , only if I use VREF_SC_MODE_LV(2) . But I can't find this information in any datasheet or reference manual? Where can I find this? Where did KEIL find this conflicting information?
And does the ADC use the buffered reference voltage or the Bandgap voltage?
And one more thing. The reference manual says the band gap voltage is 1.2V but the data sheet says 1.195V. Which is correct?
And finally one more thing. When I measure pin 37 (VREF_OUT) I get 0 V. Do I need to enable the pin? I have tried both VREF_SC_MODE_LV(1) and VREF_SC_MODE_LV(2) with no luck.
You need set the VREF bit in SIM_SCGC4 first , then configure VREF->SC.
Q1:Does the ADC use the buffered reference voltage or the Bandgap voltage?
A1:The PMC bandgap 1V reference voltage is one of the input signal for ADC. The 1.195V buffered reference voltage is one of the voltage reference source for ADC.
Q2:The reference manual says the band gap voltage is 1.2V but the data sheet says 1.195V. Which is correct?
A2:Data sheet is correct. For more detail you can see the "Table 36. VREF full-range operating behaviors" in the Data sheet (K10P144M120SF3.pdf) .