cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030 problem reading two ADC channels with DMA

Mohamed eleuche
Associate III

Hello, I am getting really frustrated with this issue for almost a week.

I am trying to read PA1 and PA4 in DMA but I get only the reading of one channel and not the other one! I tried everything and I also looked at all the example online. Please help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

I get only the reading of one channel and not the other one!

Why do you think that is the case? What readings do you get and what do you expect instead? Be specific.

> uint32_t adcValues[100]

> hdma_adc.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;

This should be an array of uint16_t, not uint32_t.

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

View solution in original post

4 REPLIES 4
TDK
Super User

I get only the reading of one channel and not the other one!

Why do you think that is the case? What readings do you get and what do you expect instead? Be specific.

> uint32_t adcValues[100]

> hdma_adc.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD;

This should be an array of uint16_t, not uint32_t.

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

Hello TDK,

thank you for your interest.

I think there are some mistakes in my code (that's why I shared the 3 main files). If someone can be so kind to have a look or suggest a working example to look at.

in my array I get:

adcValues[0]= 200 , 

adcValues[1]= 0  ,

adcValues[2]= 190 , 

adcValues[3]= 0  ,

adcValues[4]= 201 , 

adcValues[5]= 0  ,

and so fourth ...

 

 

 

Did you correct the error I noted?

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

Thank you the DMA works good. thank you