cancel
Showing results for 
Search instead for 
Did you mean: 

ADC in conjustion with DMA

Pejwaak
Associate II

Hi

I am facing an odd problem with ADC in conjunction with DMA on STM32L151V8T-A. 

I can see that it measures all three channels. However, the result of each channel is stored in the first element of my results array (Result[3]). 

Every time that the callback function is called the results of one out of three channels is stored in Result[0] element. It is as if the memory address is not increasing.

Can somebody help?

16 REPLIES 16

Hi

 

Hi

Sure. Here it is.

SofLit
ST Employee

Ok thanks. I will look at it by tomorrow or after and get back to you with a feedback

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hello @Pejwaak ,

Change Data width of Peripheral and Memory to "Word" instead of "Half Word":

SofLit_0-1711025430258.png

Please confirm if this solves your issue.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Hi

I have already tried it but tried it again any. I am attaching this screen-shot so you know exactly what I mean. Every-time ADC complete flag was set I took a screen shot. as you can see the value of the first element of ADCArray changes. I tested them and it turned out that these differents values are the values from each three channel.ADC3.PNGADC1.PNGADC0.PNG

I attached a project where I did 3 channels conversion in continuous mode with DMA on STM32L152D_EVAL board. Unfortunately, I don't have your board on hands.

The three converted channels are:

- Channel 31: potentiometer

- Channel 16: temperature sensor

- Channel 17: Vrefint

I tested the project with IAR, you can port it easily to CubeIDE with CubeMx.

As you can see in this screenshot, the data converted are arranged in the correct order.

SofLit_0-1711122362478.png

You can inspire from my project to find your issue.

Please select this answer if it does answer your question.

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

Thanks very much for your kind helps. I will have a look at your project and will get back you asap.