Multichannel ADC using DMA on STM32

Previously we have tried to do a single conversion of one ADC channel. We were waiting for the ADC result in a loop, which isn’t an effective way of using processor resources. It is better to trigger a conversion and wait for the conversion to complete the interrupt. This way, a processor can do other tasks rather than wait for ADC conversion to complete. This time we will go through another example to set up more than one channel and read ADC values using interrupt service routine. How does multichannel ADC conversion works? If we need to convert several channels continuously, we need to set up Sequence registers (ADC_SQRx). There are three sequence registers: ADC_SQR1, ADC_SQR2, and ADC_SQR3 where we can set up a maximum of 16 channels in any order. Conversion sequence starts with SQ1[4:0] settings in ADC_SQR3 register. Bits [4:0] hold the number of ADC channels.

Continue reading