Skip to main content
WBria.1
Associate II
January 12, 2022
Solved

ADC_IN0 on F030K6 not reading 3V3 voltage_divider

  • January 12, 2022
  • 2 replies
  • 863 views

I'm pluging into ADC_IN0 1x pull-up and 5x buttons, that when i pressed some button, it adds a resistor to ground and make a voltage_divider... then i read the value on ADC.

But when i pressed the button, however, my ADC shows 0 on the variable and not the Vout from voltage_divider, like 1V or 0,5V.

I'm using CubeIDE with default ADC_IN0 config and making the while(1) as follow:

   hadc.Instance->CHSELR |= ADC_CHSELR_CHANNEL(ADC_CHANNEL_0);

   HAL_ADC_Start(&hadc);

   HAL_ADC_PollForConversion(&hadc,10);

   value_adc=HAL_ADC_GetValue(&hadc);

This topic has been closed for replies.
Best answer by Tesla DeLorean

Make sure the pins and clocks are suitably configured.

Perhaps find another worked ADC example as a point of reference.

Try using existing library code rather than ORing values to a register.

2 replies

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
January 12, 2022

Make sure the pins and clocks are suitably configured.

Perhaps find another worked ADC example as a point of reference.

Try using existing library code rather than ORing values to a register.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
WBria.1
WBria.1Author
Associate II
January 12, 2022

Tks Tesla,

Almost all of examples (from internet) uses the same sequence (1. config channel, 2. start the conversion, 3. poll... and then 4. read the value)

but yeas, i can try using some of the library example to test it.