Skip to main content
Associate II
March 21, 2024
Question

ADC Returning "0" zeros

  • March 21, 2024
  • 1 reply
  • 1540 views

Hello. 

I have a problem with my ADC readings. I use Nucleo 64 with SM32G474 and ADC1 Channel 6. Pin coresponds to A5, Arduino compatible pin on board. No matter what i do, change adc or channel, i get 0 as an output. I use comands 

MX_GPIO_Init();

MX_ADC2_Init();

HAL_ADC_Start_IT(&hadc1);

I have ADC1,2 global interupts enabled in CubeMX, my HAL_ADC_ConvCpltCallback are geting

called (i checked with breakpoints). My while is running, program except ADC works normaly,

GPIOs work. Enable regular conversions i have DISABLED, so i use software calls for ADC.

Scan Converscion and Continious Conversion i have both DISABLED. I tried almost everything.

No matter what i do HAL_ADC_GetValue() always returns me 0.

 

 

1 reply

Technical Moderator
March 21, 2024

Hello @Miha ,

First let me thank you for posting and welcome to the ST Community.

I advise you to consult this Wiki and this Post

It explains what ADC is and how to use it through an example.

Thanks.

Mahmoud.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.