How to read bandgap?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to read bandgap?

Jump to solution
2,220 Views
adampribyl
Contributor I

I am trying to do a temperature sensor measurement according AN3031 on FRDM-KL25. I used PE to generate the code. I can read stable results from ADC for tempsensor and for Vrefh but the internal bandgap is floating a lot. Even the +-3% accuracy of internal bandgap can not explain it.

The code is as "easy" as this:

      AD1_MeasureChan(1, 0);

      AD1_GetChanValue16(0, &adcvalue);

      printf("ADC value: %d, ", adcvalue);

      AD1_MeasureChan(1, 2);

      AD1_GetChanValue16(2, &adcvalue);

      printf("Bandgap: %d ", adcvalue);

      AD1_MeasureChan(1, 1);

      AD1_GetChanValue16(1, &adcvalue);

      printf("Temperature sensor: %d, ", adcvalue);

      AD1_MeasureChan(1, 2);

      AD1_GetChanValue16(2, &adcvalue);

      printf("Bandgap: %d ", adcvalue);

      AD1_MeasureChan(1, 3);

      AD1_GetChanValue16(3, &adcvalue);

      printf("Vrefh: %d \r\n", adcvalue);

ADC is in 16bit mode single ended 10us, low power mode, high speed conversion, async clock. With 1 conversion I receive completely insane values after bandgap read looks like it depends on the previous read, with 64 conversion it is from 20000-26000 which is way too much to do any reasonable calculation of the temperature. I can change the ADC properties but is has no influence on the results. I may be doing something completely wrong, but ATM do not see what.

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,050 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Please check my attached project, which use FRDM-KL25Z board to read bandgap voltage with ADC0_A.

Please check PMC_REGSC [BGBE] bit need be set to enable Bandgap generate voltage.

Wish it helps.

View solution in original post

0 Kudos
3 Replies
1,051 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Please check my attached project, which use FRDM-KL25Z board to read bandgap voltage with ADC0_A.

Please check PMC_REGSC [BGBE] bit need be set to enable Bandgap generate voltage.

Wish it helps.

0 Kudos
1,050 Views
adampribyl
Contributor I

Thanks a lot, it is in Ref. manual, I just missed this note "2".

0 Kudos
1,049 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Adam,

I will try to do the same test with FRDM-KL25Z board. I will let you know when I got any info.

Thank you for the patience.

B.R.

Ma Hui

0 Kudos