2023-07-28 04:24 AM
Hello everyone!
I'm trying to use ADC1 and ADC2 with DMA from a NucleoBoard STM32H732 under STM32CubeIDE. I am following the tutorial presented here:
By setting up ADC3 according to the tutorial, everything works as expected. But I noticed that even though I linked DMA1 stream 1 to ADC1 (Figure 1), just like DMA1 stream 0 is linked to ADC3.
I don't get the option to run "DMA Continuous Request" like it does in the "ADC3 Configuration" tab (compare Figures 2 and 3). I've tried just adding these lines manualy to the generated C code without any succes.
From what I understand from "RM0468 Reference Manual" page 673 mapping of ADC1 and DMA seems possible, but that is far from a beginner's knowledge.
Is this device uncapable to perform a two channel conversion (ADC1 and ADC2) with DMA at the same time? (or at least one with ADC1 or ADC2?)
Some others had problems with the STM32H74 MCU with a bug in the RAM addresses, but I don't think that's the case here when the device can't handle ADC1 and ADC2 and DMA to begin with, and it's a different device.
Thank you for your help
Solved! Go to Solution.
2023-08-02 05:47 AM
Until now I have only used ADC3 on a H723.
So ADC1 and ADC2 seem to behave quite differently...
I was just curious and started CubeMX.
When setting parameters for ADC1, you first have to enable DMA under the "DMA settings" tab (choose circular),
then you switch back to the "Parameter Settings" tab and for the parameter "Conversion Data Management Mode" you can select "DMA Circular Mode".
It's a lot of stuff, read the datasheet and the reference manual to understand what's happening, and also go through the HAL sources.
2023-07-28 06:50 AM - edited 2023-07-28 06:51 AM
You can definitely use DMA on ADC1, ADC2 and ADC3 all simultaneously and trigger them all continuously, not sure why the option isn't showing up. I suspect it may have to do with the differences between ADC1/2 (16-bit) and ADC3 (12-bit).
2023-08-02 02:07 AM
Dear TDK,
Thank you for your reply, I've tried to make it work only with ADC1 and still no DMA option available at 12-bit or 16-bit. I also naively attempted to add the missing code to ADC1 configuration in main.c (see figure) hoping it would take it, it copiles but does not work.
Any suggestion to make it work? At least only for ADC1 to start.
Kind regards
2023-08-02 05:47 AM
Until now I have only used ADC3 on a H723.
So ADC1 and ADC2 seem to behave quite differently...
I was just curious and started CubeMX.
When setting parameters for ADC1, you first have to enable DMA under the "DMA settings" tab (choose circular),
then you switch back to the "Parameter Settings" tab and for the parameter "Conversion Data Management Mode" you can select "DMA Circular Mode".
It's a lot of stuff, read the datasheet and the reference manual to understand what's happening, and also go through the HAL sources.
2023-08-16 07:15 AM
Hello LCE,
Thank you for your helpful reply
I've followed the steps you described and ADC1 is working, even if you select "DMA One Shot Mode" under "Conversion Data Management," which works better for my application. Furthermore, I was able to read from ADC1 and ADC3 at the same time (sequential activation).
"
HAL_ADC_Start_DMA(&hadc1, (uint32_t*)adc_buf, ADC_BUF_LEN);
HAL_ADC_Start_DMA(&hadc3, (uint32_t*)adc_buf2, ADC_BUF_LEN);
"
and data was retrieved from both of them. Although for some reason ADC1 drops to 0 by the end of the recording...
Now it seems that this configuration is interfering with one of the two DAC channels I am actuating "simultaneously".
If you have any idea, please let me know.
Thank you in advance.
Kind regards