In the context of an STM32L496 project, I've setup the ADC with two input channels as follows
And the DMA like this:
I'm using the following code to start the conversion and display the results:
adc_done = 0;
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) adc_results, 2);
while (!adc_done) {
HAL_Delay(1);
}
for (int i = 0; i < 2; i++) {
printf("ADC%d: %.4X", i + 1, adc_results[i]);
}
HAL_ADC_Stop_DMA(&hadc1);
For some reason, it seems that only the very first byte of my adc_results
buffer gets updated. All the other bytes remain at their default values, which I've set to 0xAA
.
What could be the reason for this? I'm suspecting that this is more of a DMA than an ADC issue.