cancel
Showing results for 
Search instead for 
Did you mean: 

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

Jimit7
Associate II

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,


5 REPLIES 5
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:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.
Jimit7
Associate II

Hi,

I using stm32wb5mmghtr6 with SDk 1.20.0

Thank you,

Jimit

Jimit7
Associate II

Is there any update on this?
Thank you,
Jimit

Hello @Jimit7 

The STM32WB5MMGH6TR is use an STM32WB MCUs. So, I suggest you have a look at this example and try to migrate it from the NUCLEO board to the STM32WB5MMGH6TR. it should be working fine. After that, you can understand how it works and develop your own example referring to this implementation.

Best Regards.

STTwo-32

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.

Jimit7
Associate II

Hi STTwo-32,

My code is based on one of the example code from Nucleo board and it does not work for me.

Thank you,

Jimit