2025-11-06 3:36 AM
Hi,
Im new to STM and trying to use 1 adc with DMA with 2 input and reading value.
Board :
STM32H753XI EVAL
ADC 1 :
INP0 rank 1
INP1 rank 2
Functions :
void adc_dma_multi(void)
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
Results :
I tried to swap rank between INP0 and INP1 to check if my second entry was read correctly and there were no hardware problems, and the result is the same: rank1 is read correctly but rank2 = 0.
I have attached main.c and IOC.
Solved! Go to Solution.
2025-11-07 12:54 AM
Hello @HugoSTM32 ,
Welcome to ST's community!
To resolve the issue where the second ADC channel consistently reads zero, please use a buffer of type uint16_t for the ADC DMA data, as recommended by @TDK . This type ensures proper data size and will naturally be aligned to a 4-byte boundary, which is important for reliable DMA operation on STM32H7 devices.
Additionally, verify that the GPIO pins corresponding to ADC_CHANNEL_0 and ADC_CHANNEL_1 are correctly configured in analog mode with no pull-up or pull-down resistors, for example:
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1; //PA0 and PA1 as an example
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);2025-11-06 6:03 AM
adc_buffer should be an array of uint16_t, not uint32_t.
Not the main issue here, but adc_buffer needs to be cache-aligned, otherwise SCB_InvalidateDCache_by_Addr will clobber other variables as well.
2025-11-07 12:54 AM
Hello @HugoSTM32 ,
Welcome to ST's community!
To resolve the issue where the second ADC channel consistently reads zero, please use a buffer of type uint16_t for the ADC DMA data, as recommended by @TDK . This type ensures proper data size and will naturally be aligned to a 4-byte boundary, which is important for reliable DMA operation on STM32H7 devices.
Additionally, verify that the GPIO pins corresponding to ADC_CHANNEL_0 and ADC_CHANNEL_1 are correctly configured in analog mode with no pull-up or pull-down resistors, for example:
GPIO_InitStruct.Pin = GPIO_PIN_0 | GPIO_PIN_1; //PA0 and PA1 as an example
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);