cancel
Showing results for 
Search instead for 
Did you mean: 

Is there an example of dual simultaneous ADCs for the STM32H5?

Using NUCLEO-H563ZI, FW_H5 V1.3.0, CubeIDE 1.16.0, MacOS 14.5.

I've been beating my head against the wall, getting some test code going.

4 ADC channels, 2 on ADC1, 2 on ADC2.

Conversions triggered by timer 3. (200 groups of 4 conversions per second)

Results delivered using DMA.

I've done this before with F4s and F7s, but the H5 is kicking my butt and the example code set for the H5 is incomplete and doesn't have an ADC sample similar to this so far.

I've put together an IOC file and generated code with no changes from the generated code, and when that code initializes ADC2, the error handler gets called when HAL_ADCEx_MultiModeConfigChannel fails after a call to ADC_MULTI_SLAVE. I'm not sure what it's doing, but I must be missing something in the IOC model since it can't get through the init code.

Is there a working example of dual simultaneous for the H5s, or a processor like the H5s that uses the GPDMA unit, or what am I missing in my IOC file?

Thanks,

Andrei from The Great White North

5 REPLIES 5
AScha.3
Chief II

Hi,

just to understand: 200 groups of 4 conversions per second -> so you want just 4 conversions per second or 800 ?

And why then dual simultaneous ADC and DMA ?

Just for fun, to make it as complicated as possible and to test it - or why ?

If you feel a post has answered your question, please click "Accept as Solution".
nouirakh
ST Employee

Hello @AScha.3 

I don’t think there is simultaneous/DMA exmple for H5, I’ll take a look at your IOC configurations and let you know what I find.

No, you misunderstand.

It's 800 per second. This is just a test program. I usually deal with about 14 channels, which would be 2800 samples per second. But I was just trying to figure out how to get a minimal scanning (more than one channel per ADC) simultaneous (more than one ADC) DMA project going at all. As soon as I try enabling the second ADC, the CubeMX generated init code fails, it doesn't even get to my code.

I use dual simultaneous because some of the channels have to be measured simultaneously, like measuring the voltage and current of the same signal to get power. If the signal varies (sinusoidal) or if the samples are not near enough together, they are not measuring the same signal.

I also trigger the ADCs using a timer so that the samples are EXACTLY n ms. apart. The people that I work with are engineers and physicists, so having the timing vary - even slightly - goes against their retentive nature.

There are samples for the F4 called ADC_TripleModeInterleaved that shows this quite well, but using three ADCs since the F4 has three.

Thank you @nouirakh. I have not been able to find an existing example, but I'm also not sure which other processor families use the H5 style DMA IP.

nouirakh
ST Employee

Hello @Andrei Chichak 

This is a CubeMX generation problem, CubeMX calls HAL_ADCEx_MultimodeConfigChannel in the ADC2 config while this function should only be called with the ADC master (ADC1).

The blue box function must therefore be removed:
image.png