cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7 multi-channel ADC & DMA config help

Mr. Berticus
Associate II

I'm having a very tough time getting more than 1 channel of an ADC instance using DMA to work on the Nucleo-H753 board. No matter what I try, nada... After rigorous debug, found that the ADC is NOT even starting when I call it to right before my while(1) loop... It saying that there is an internal error (17) and fails to start. This leads me to think that there's a config issue/error on my end. Any tips on setting up multiple ADC channels using DMA on the STM32H7 line would be greatly appreciated, as they have the fancier/more finicky 16b ADCs

10 REPLIES 10
Pavel A.
Evangelist III

What have you tried? Maybe, following any ST examples?

0693W00000LypceQAB.png0693W00000LypcZQAR.pngYes, I've went through several examples, to no avail. Here's a snippet of my ADC config, main.c, and my CubeMX file. Please let me know if anything is setup wrong or if I'm missing something entirely. Many thanks in advance!

What is "beyond ridiculus", the CubeMX's bugs; or the question I posted?

The CubeMX, of course! The link I gave is not about bugs, but about a single bug which has not really been fixed in years, because it reappears again, and again, and again...

Petr DAVID
ST Employee

Hello Mr. Berticus,

have you been able to fix the problem? For clarification part of the problem of your code is linked to order of initialization of peripherals caused to a bug in STM32CubeMX as described in the thread posted by Piranha and solution described here. Further you initialize 2 channels, but in your code it seems you are interested in reading three channels and at last you are not supposed to use HAL_ADC_GetValue. In case of using DMA the values supposed to be in the specified buffer that you have chosen in HAL_ADC_Start_DMA.

You supposed to define function void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc). That will be called each time the buffer is filled with the new values. This is described in this video.

Please let me know if I you will have further problems.

Hi Petr DAVID,

I should've clarified initially that I was trying a multitude of different things to try to get this working. As of this morning, I haven't been able to get it working, unfortunately. I will follow your advice and let you know how it works out. Also, I believe there should be a pop-up window at time of project creation in CubeMX asking the user to verify the silicon rev (Y or V) of the micro on their Nucleo board before they begin. I wasn't aware that it even existed in the "RCC" tab, or that it was even an option... Idea for the next CubeMX release?

Thank you,

Mr. Berticus

Pavel A.
Evangelist III

> I believe there should be a pop-up window at time of project creation in CubeMX asking the user to verify the silicon rev (Y or V)

This is not a popup window - at least not for STM32H7. The Y vs V stepping selection is in RCC -> system parameters.

KStef.1
Associate

For others who are facing issues with ADC with DMA, you need to be aware of the potential issues of using DMA on cached memory space. I cannot post the link here because I'm new, but you can search for "DMA is not working on STM32H7 devices". It is a knowledge article from ST.