cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L051 Temperature Sensor start up time

Posted on July 28, 2015 at 13:57

Dear all

I configured the ADC of my STM32L051C8 (Revision Z) to measure temperature. I saw in the errata sheet DM00114897 that there are issues if there is a time greater than 0.5ms between two measurement.

How ever, my first conversion always brought up a bad value. Allowing settling time (after configuration) of 5ms improved the result. Waiting for 10ms solved the Problem. The datasheet states, that the Maximum settling time would be 3ms.

Could that be an other error in the Hardware? 

Here's my config (I use HSI16 on 16MHz, Voltage Range 2):

void InitAdc(void)

{

 __HAL_RCC_ADC1_CLK_ENABLE();

 ADC1->CFGR2 |= ADC_CLOCKPRESCALER_PCLK_DIV1;

 ADC1->CFGR1 &= ~ADC_CFGR1_CONT;       

 ADC1->CHSELR = ADC_CHSELR_CHSEL18;      

 ADC1->SMPR |= ADC_SAMPLETIME_239CYCLES_5;    

 ADC->CCR |= ADC_CCR_TSEN;         

 SYSCFG->CFGR3 |= SYSCFG_CFGR3_ENBUF_SENSOR_ADC | SYSCFG_CFGR3_EN_VREFINT;

 ... wait until SYSCFG_CFGR3_SENSOR_ADC_RDYF is cleared

}

Currently I just discard the first value.

Any hints are appreciated.

Chris
0 REPLIES 0