How can I measure temperature using the internal ADC temperature sensor?


The "Temperature Measurement" subsection of the ADC chapter in the reference manual contains an expression for this temperature result (TCELSIUS) in terms of the following parameters:


  • CAL_TEMP - available in the Device Information (DI) Page, see "DI Page Entry Map" section in Reference Manual for more information
  • ADC0CAL3_TEMPREAD1V25 - also available in DI page
  • V_TS_SLOPE - available in the device Datasheet
  • VFS - specified as 1.25V (1250mV) in the provided expression
  • ADC_result - ADC measurement at 1.25V VFS option and 12-bit resolution

The "inttemp" example for the EFM32 Pearl Gecko (available in-full within Simplicity Studio) demonstrates in ConvertToCelsius() how this technique is implemented using the DI contents on the Pearl Gecko and the formula provided in section "Temperature Measurement" of the Pearl Gecko Reference Manual. Though the variable names are slightly different, this is an identical procedure to that given in section "Temperature Measurement" of the EFR32BG1 Reference Manual.



 * @brief Convert ADC sample values to celsius.
 * @detail See section in the reference manual for detail on
 *   temperature measurement and conversion.
 * @param adcSample Raw value from ADC to be converted to celsius
 * @return The temperature in degrees celsius.
static float ConvertToCelsius(int32_t adcSample)
  uint32_t calTemp0;
  uint32_t calValue0;
  int32_t readDiff;
  float temp;

  /* Factory calibration temperature from device information page. */
              >> _DEVINFO_CAL_TEMP_SHIFT);

  calValue0 = ((DEVINFO->ADC0CAL3
                /* _DEVINFO_ADC0CAL3_TEMPREAD1V25_MASK is not correct in
                    current CMSIS. This is a 12-bit value, not 16-bit. */
                & 0xFFF0)
               >> _DEVINFO_ADC0CAL3_TEMPREAD1V25_SHIFT);

  if ((calTemp0 == 0xFF) || (calValue0 == 0xFFF))
    /* The temperature sensor is not calibrated */
    return -100.0;

  /* Vref = 1250mV
     TGRAD_ADCTH = 1.835 mV/degC (from datasheet)
  readDiff = calValue0 - adcSample;
  temp     = ((float)readDiff * 1250);
  temp    /= (4096 * -1.835);

  /* Calculate offset from calibration temperature */
  temp     = (float)calTemp0 - temp;
  return temp;



  • Knowledge Base Articles
  • 32-bit MCUs
  • Before this can be done I think the ADC has to be initiated? Above the aforementioned temperature section of the manual it says "The configuration of single channel mode is done using the ADCn_SINGLECTRL and ADCn_SINGLECTRLX registers..."

    How is this done? Could you elaborate a bit for me please? Are these contained in instructions in Case code? Is this put in the main.c file?

  • Hello,


    This KB article describes how to convert a ADC conversion of the internal temp sensor from raw ADC codes into a temperature expression.


    For information re: how to use the ADC to obtain the initial conversion, please see the "inttemp" example for the EFM32 Pearl Gecko (available in-full within Simplicity Studio), or application note "AN0021: Analog to Digital Converter" available from


    Best regards,

    - Phillip

  • Hi,


    AN0021 code

    I did instal the AN0021 application note (code) as instructed and was able to import inot work space. Once imported there are three folders (presuming the pg is the closest to my BGM1xx) adc_example_


    However when I try and debug it says no program file (works for me other own projects. Can I just import the c files into an existing project:


    main_adc_example_gecko_s1.c (or soc)?


    If is this supposed to replace the main.c file; or would I just put them in one of the folders and refer to them in main.c with #include...?



    There is intemp in the peripherals example folder but unfortunatley the peripheral examples do not work with my SDK - I have been trying to resolve for a while on this thread but not much luck so far (can you help?):




    Thank you,