2025-05-12 10:47 AM
I have4 set up a 9 channel DMA adc
Below is the DMA configuration in the IDE
This is the ADC configuration
This is the IRQ routine
This is where I treat the data. For every loop it gets added to another array after the conversion.
Then a simple routine that divides the accumulated value by the amount of conversion and then some tweaking
On A1 I have a potentiometer with a dividing resistor that I take 28V down to 3.3V the CPU voltage. Very basic
It seems that the conversion get scattered on all the channels and the max reading I can get is 170 with 1.3V on A0.
This is the aray volatile:
uint16_t AD_RES_BUFFER[11] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
I am not sure what is happening can any one please assist.
Thanks
Solved! Go to Solution.
2025-05-13 12:00 AM
Many thanks.
I did find the fault.
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) AD_RES_BUFFER, 9);
The 9 was set to 11. 11 For ref and internal temp.
I expected the "driver" to start from channel 01 (1) which it did not do.
My fault.
Thanks
2025-05-12 11:16 AM
Hi @erastusC ,
I would suggest simplifying your setup to reproduce the issue with fewer variables and fewer possible places where a mistake might be made.
A single channel ADC with input connected to 0 or 3.3v should result in the full ADC range, and once that's working you could start adding complexity such as: enable cache (if wanted), add DMA, multiple channels and your post-processing code etc.
Good luck, hope this helps.
2025-05-13 12:00 AM
Many thanks.
I did find the fault.
HAL_ADC_Start_DMA(&hadc1, (uint32_t*) AD_RES_BUFFER, 9);
The 9 was set to 11. 11 For ref and internal temp.
I expected the "driver" to start from channel 01 (1) which it did not do.
My fault.
Thanks