Skip to main content
Graduate
June 24, 2024
Solved

stm32l072 adc multi channel reading problem

  • June 24, 2024
  • 1 reply
  • 1692 views

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

 

    This topic has been closed for replies.
    Best answer by VasuManiV

    Read this once.

     

    VasuManiV_0-1719231620856.png

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

    1 reply

    Visitor II
    June 24, 2024

    Hi,

     

    Have configured the DMA correctly?

    Please refer the below images for DMA and ADC configurations.

    VasuManiV_0-1719229419289.pngVasuManiV_1-1719229471974.png

     

    amorftorAuthor
    Graduate
    June 24, 2024

    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

     

    VasuManiVAnswer
    Visitor II
    June 24, 2024

    Read this once.

     

    VasuManiV_0-1719231620856.png

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