Skip to content

STM32 ADC on Vref Channel 17 doesn't work correctly under 3.5 #67074

Answered by ronsegal
ronsegal asked this question in Q&A
Discussion options

You must be logged in to vote

Ok, so responding to my own question now it seems, which hopefully will be helpful to others.
To enable Vref output for its internal adc channel (would be the same for temp and vbat internal), there may be a better approach but in any case I did the following:

  1. Prepare the application to use STM HAL by adding a Kconfig specification file to the application:
 mainmenu "My Application"

config MYAPP_STM32
  default y
  bool
  select USE_STM32_HAL_ADC
  select USE_STM32_HAL_ADC_EX

source "Kconfig.zephyr"
  1. Add #include <soc.h> to the application main.c
  2. Before adc_channel_setup in main for channel 17, internal vref add HAL_ADCEx_EnableVREFINT( ); then after adc_read add HAL_ADCEx_DisableVRE…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@gautierg-st
Comment options

@ronsegal
Comment options

Answer selected by ronsegal
Comment options

You must be logged in to vote
1 reply
@ronsegal
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants