Multi-channel continuous ADC (DMA) application [ADC of STM32]

This is a practical application that automatically converts multiple channels of analog signals in succession on an STM32 MCU and retrieves them into memory. Please understand it completely and make use of it by all means.

So far I have dealt with AD conversion of a single channel.
This section describes a program that registers multiple channels into a regular conversion group to read the analog voltages input to pins PA0 and PA1 and then transfers them to memory by DMA.

 To convert the analog conversion values of two channels to memory by DMA: 

  • Prepare variables (memory) to store AD conversion values for the number of channels.
    In the case of 2CH, for 2 ADCValue[0] and ADCValue[1].
  • DMA configuration Address &ADValue of stored variable in DMA_AD1_Configuration()
  • BufferSize(buffer size) with number of channels 2
  • Specify DMA.MemoryInc(memory increment)as enabled

Prepare an array of memory to store the analog conversion values for two channels, and specify the first address of the array when setting DMA.

Specifying the DMA buffer size to the same number 2 as the prepared array and enabling memory incrementing automatically repeats the transfer to memory according to the ADC channel.

Follow me!