Skip to main content
Visitor II
November 8, 2024
Solved

Read all ADC channels triggered by a timer and use DMA - NucleoC031C6

  • November 8, 2024
  • 2 replies
  • 723 views

Hi All, 

 

I want to read all ADC channels from the nucleo c031C6 using DMA all channels should be read continuously. For example 1k samples per seccond. I have tried to configure lots of different approaches in the CubeMX, but I can not figure it out. 

Can anyone give me a hint on how to set ADC and DMA settings in CubeMX? 

Cheers

 

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

    Hello, 

    I am sending simple example which periodically (1kHz) read all analog inputs and each values writes to memory by DMA and periodically print read values from memory to usart.

    ADC was configured:

    - All inputs except IN2, IN3 (pins used by usart), Temperature sensor, Vrefint Channel, VDDA Channel, VSSA Channel

    - 8 bit resolution

    - DMA Continuous Requests Enabled

    - External trigger conversion source as Timer 3 Trigger Out event

    - Other configurations stay as defaults

    - DMA mode circular, Peripheral to memory, Data Width as Byte

    TIM3 is configured as:

    - Clock Source as Internal Clock

    - Counter Period to 47 999

    - Trigger Event Selection TRGO as Update Event

    SYSCLK was configured to 48 MHz

    2 replies

    Technical Moderator
    November 8, 2024

    Hello @stm32user2 and welcome to the community,

    You need to show what you have done at this stage: share your code, your ioc file etc.. to let others guide you to the solution.

    Tips on posting a thread.

    Thank you.

    Hl_stAnswer
    ST Employee
    November 14, 2024

    Hello, 

    I am sending simple example which periodically (1kHz) read all analog inputs and each values writes to memory by DMA and periodically print read values from memory to usart.

    ADC was configured:

    - All inputs except IN2, IN3 (pins used by usart), Temperature sensor, Vrefint Channel, VDDA Channel, VSSA Channel

    - 8 bit resolution

    - DMA Continuous Requests Enabled

    - External trigger conversion source as Timer 3 Trigger Out event

    - Other configurations stay as defaults

    - DMA mode circular, Peripheral to memory, Data Width as Byte

    TIM3 is configured as:

    - Clock Source as Internal Clock

    - Counter Period to 47 999

    - Trigger Event Selection TRGO as Update Event

    SYSCLK was configured to 48 MHz