2025-01-14 11:41 AM - last edited on 2025-01-14 01:21 PM by SofLit
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:
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,
2025-01-14 01:22 PM
Hello,
Please provide the MCU part number.
See Tips on posting.
Thank you for your understanding.
2025-01-14 01:26 PM
Hi,
I using stm32wb5mmghtr6 with SDk 1.20.0
Thank you,
Jimit