Get internal temperature or voltage STM32L0
This script works for me. It's very important to initialize and configure ADC before configure the temp sensor part.

/#define TEMP130_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007E))
/#define TEMP30_CAL_ADDR ((uint16_t*) ((uint32_t) 0x1FF8007A))
/#define VDD_CALIB ((uint16_t) (300))
/#define VDD_APPLI ((uint16_t) (330))

int32_t ComputeTemperature(uint32_t measure)
{
  int32_t temperature;
  temperature = ((measure * VDD_APPLI / VDD_CALIB) - (int32_t)*TEMP30_CAL_ADDR );
  temperature = temperature *(int32_t)(130-30);
  temperature = temperature /(int32_t)(*TEMP130_CAL_ADDR -*TEMP30_CAL_ADDR);
  temperature = temperature + 30;
  return(temperature);
}


void ConfigTemperature(void)
{
    RCC-&gt;APB2ENR |= RCC_APB2ENR_ADC1EN;
    ADC1-&gt;CFGR2 |= ADC_CFGR2_CKMODE;

    if ((ADC1-&gt;CR &amp; ADC_CR_ADEN) != 0) 
    {
     ADC1-&gt;CR &amp;= (uint32_t)(~ADC_CR_ADEN); 
    }

    ADC1-&gt;CR |= ADC_CR_ADCAL; 

    while ((ADC1-&gt;ISR &amp; ADC_ISR_EOCAL) == 0)
    {
        pcMain.printf("Calib");
    }

    ADC1-&gt;ISR |= ADC_ISR_EOCAL;
    ADC1-&gt;ISR |= ADC_ISR_ADRDY; 
    ADC1-&gt;CR |= ADC_CR_ADEN; 

    if ((ADC1-&gt;CFGR1 &amp; ADC_CFGR1_AUTOFF) == 0)
    {
     while ((ADC1-&gt;ISR &amp; ADC_ISR_ADRDY) == 0) 
     {
         pcMain.printf("Enable");
     }
    }

    ADC1-&gt;ISR |= ADC_ISR_ADRDY; 
    ADC1-&gt;CR |= ADC_CR_ADEN; 
    ADC1-&gt;CFGR1 |= ADC_CFGR1_CONT;
    ADC1-&gt;CHSELR = ADC_CHSELR_CHSEL18; 
    ADC1-&gt;SMPR |= ADC_SMPR_SMP; 
    ADC-&gt;CCR |= ADC_CCR_TSEN;

    uint32_t measure = ADC1-&gt;DR;
    pcMain.printf("Measure %i\n\r", measure);
    pcMain.printf("The temperature value is %i\n\r",ComputeTemperature(measure));
}

int main(void)
{
    ConfigTemperature();
}