Skip to main content
gocchan
Associate III
July 6, 2026
Solved

How to implement ADC4

  • July 6, 2026
  • 1 reply
  • 58 views

I set PA6 and PA7 to ADC4_INx in CubeMX and ran CODE GENERATE.

The generated main.c file implements MX_ADC4_Init(), but it doesn't seem to be called from anywhere.
Should I call this somewhere in the main statement?

Also, I tried implementing ADC reading within the main loop, but the return value of HAL_ADC_GetValue() is always 0 (even though it's actually around VDD/2).

I've attached main.c. Could you please tell me the correct implementation method?

Best answer by AScha.3

Check in Cube : is the call disabled ?  = > do not gen. function call <

 

1 reply

AScha.3
AScha.3Best answer
Super User
July 6, 2026

Check in Cube : is the call disabled ?  = > do not gen. function call <

 

If you feel a post has answered your question, please click on " Best Answer ".