cancel
Showing results for 
Search instead for 
Did you mean: 

stm32l072 adc multi channel reading problem

amorftor
Associate II

I am trying to read multiple ADC channels using the Stm32l072 microcontroller, but in CubeMX, the options for rank assignments, which I normally use to read the channels, are not available. After manually adding these rank assignments to the init functions, I noticed that when I try to read multiple channels in normal mode, both channels show the same values, indicating that I am unable to perform multi-channel reading.

I then attempted to perform this ADC reading using DMA, but observed that my reference voltage, which should be around 4095, was divided by the number of channels I was reading. For example:

  • Number of channels to read: 4 -> VREF ADC value: 1.023
  • Number of channels to read: 3 -> VREF ADC value: 1.365

Normally, my VREF should be 3.29V, which is very close to 4090. This observation led me to realize that I am unable to read even a single channel correctly. How can I perform multiple ADC readings with this microcontroller?

amorftor_0-1719228709034.png

 

1 ACCEPTED SOLUTION

Accepted Solutions

Read this once.

 

VasuManiV_0-1719231620856.png

I think you have to configure this scan register and it will convert sequentially one by one.

View solution in original post

3 REPLIES 3
VasuManiV
Associate III

Hi,

 

Have configured the DMA correctly?

Please refer the below images for DMA and ADC configurations.

VasuManiV_0-1719229419289.pngVasuManiV_1-1719229471974.png

 

Yes, I have the correct settings for dma, but configurations such as rank assignment that appear in your 2nd image do not appear on my cubemx. This is exactly my problem.

amorftor_0-1719230368157.png

amorftor_1-1719230468621.png

 

Read this once.

 

VasuManiV_0-1719231620856.png

I think you have to configure this scan register and it will convert sequentially one by one.