cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L496 ADC in single ended channel

Georgios
Associate

Hello,

I am trying to run a simple code for the reading of a single channel of one of the three ADCs available on the STM32L496. I have tried to use different channels while using the code generated from STM32CubeIDE. I use the default configurations (single ended, polling mode etc) but when I read the ADC I get 0xFFF. The sequence of operations I perform are:

ADC_Enable(&hadc2);

HAL_ADC_Start(&hadc2);

status = HAL_ADC_PollForConversion(&hadc2,100);

adc_value = HAL_ADC_GetValue(&hadc2);

HAL_ADC_Stop(&hadc2);

after which I send the adc_value via LPUART. I have used the same code with an STM32F439 nucleo board and it worked properly, so I am wandering if there are fundamental differences between the L4 and the F4 HAL regarding the ADC that I haven't noticed yet.

Any help can be useful, thanks!

2 REPLIES 2
egoltzman
Senior

Hi, I'm facing the same issue, have you solve this? Thanks!

MKuma.18
Associate

Hi, did you checked the VREF+ pin?

I had the same problem on STM32L496G-DISCO board.

On the STM32L496G-DISCO board, VREF+ pin is not connected to VDDA by default.

because VREF+ can be used as an output pin as well as an input pin on STM32L496.

If VREF+ is nearly 0V, the converted data always becomes to 0xfff.

I solved it by implementing a 0 ohm register at R18 to connect between VREF+ and VDDA.