cancel
Showing results for 
Search instead for 
Did you mean: 

ADC: DMA ADC value is not updating after first reading.

Jimit7
Associate

I have configured the ADC in DMA mode to read a single pin for measuring external voltages.
However, I’m encountering an issue where the ADC value is measured correctly on the first call, but on subsequent calls to the function, the ADC value does not get updated. It remains the same regardless of any external voltage applied.

In other words, it only shows the first measured value all the time.

Below is the configuration for the ADC:

Jimit7_0-1736882461393.png

ADC CLK is set to 12MHZ.
Below is the ADC reading function.

void ADC(void)

{

uint16_t ADC_Data;

HAL_ADCEx_Calibration_Start(&hadc1, ADC_SINGLE_ENDED);

HAL_ADC_Start_DMA(&hadc1,(uint32_t*)&ADC_Data ,1);

printf("ADC: %d\n",ADC_Data);

HAL_ADC_Stop_DMA(&hadc1);

}

Thank you,


2 REPLIES 2
SofLit
ST Employee

Hello,

Please provide the MCU part number.

See Tips on posting.

Thank you for your understanding.

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.
PS: Be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help/support.
Jimit7
Associate

Hi,

I using stm32wb5mmghtr6 with SDk 1.20.0

Thank you,

Jimit