cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G431 - ADC + DMA using HAL not working

merdouille
Associate II

Hi,

I am trying to make the ADC + DMA work a STM32G431CBT6 using STM32CubeIDE and the HAL library. I am used to making it work on other families like the STM32f103 etc.. However, here, when I program the processor using the debug mode and watch the content of my adc/dma buffer, all the values are at 4095 (maximum) and stay like this... 

Has anyone an idea on how to make this work? or any suggestions based on my code?

Please find my code and CubeMX settings in the following images.

 

Thanks in advance,

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
merdouille
Associate II

Thanks a lot for your advice @Issamos!

I have found the issue btw: the ADC'S were totally saturated due to a misuse of VREF. I was used to work with other MCUs that did it differently (F1 , F3, etc). So , always check your reference voltage settings and Connections!

View solution in original post

5 REPLIES 5
merdouille
Associate II

CaptureA.JPG

CaptureB.JPG

CaptureC.JPG

   

Issamos
Lead II

Hello @merdouille 

Try to use one of those 2 ready to use projects.

Best regards.

II

merdouille
Associate II

Thanks a lot for your advice @Issamos!

I have found the issue btw: the ADC'S were totally saturated due to a misuse of VREF. I was used to work with other MCUs that did it differently (F1 , F3, etc). So , always check your reference voltage settings and Connections!

Happy to know that your problem has been solved. If so, close the topic by choosing a best answer.

Best regards.

II

This answer was helpful as I was having an ADC/DMA issue with an STM32G0B1.  I was tricked into thinking the ADC was not updating via DMA.  Turns out, my values, liked yours, were simply just pegged at 0xFFF.

The reason I am adding to your answer, is the solution was not very apparent to me:

If using CUBE, go into System->SYS and scroll down to find the "VREFBUF Mode" pulldown menu and activate the internal reference.

As as side note, this was the first controller I had used that contained ST's newer ADC module.  I was not aware of the decoupling caps needed on the VRef+ pin in order to use the internal buffer.  As one would expect, even though fixing the VREF setup made the ADC values believable, there was an abundance of noise until I added some capacitance.