1
\$\begingroup\$

In the context of an STM32L496 project, I've setup the ADC with two input channels as follows

enter image description here

And the DMA like this:

enter image description here

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.

\$\endgroup\$
1
  • \$\begingroup\$ Did you resolve the issue? Unfortunately I have the same problem. \$\endgroup\$
    – Artur
    Commented Apr 25, 2022 at 18:12

1 Answer 1

1
\$\begingroup\$

I was having a similar issue, I was able to fix it by setting DMA Continuous Requests to Enabled.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.