The document discusses analog to digital converters (ADCs) and provides an example algorithm and code for collecting sensor data using an STM32 microcontroller ADC with direct memory access (DMA). The algorithm involves initializing the ADC and timer in scan mode, configuring DMA to transfer ADC conversion results to memory, and using an interrupt handler to start USART transmission when transfer is complete. Example code shows configuring the ADC and DMA for circular buffer operation to continuously sample sensor channels and transmit data via USART.
9. STM32 ADC
A/D conversion can be:
•Single Conversion. One sample conversion at a given instant.
•Continuous Conversion. Non-stop sample collection and conversion.
•Discontinuous Conversion. Sequential conversion of some channels in a group.
•Scan Conversion. Sequential sampling and converting of an array of channels one after
another.
To start A/D conversion, an ADC unit needs to be stimulated with a trigger signal:
•Software Trigger. A/D conversion as per demand from coded program.
•Hardware Trigger. A/D conversion as per hardware events like external interrupts or timer
events.
16. Algorithm
1. Enable ADC and config required GPIO pins.
2. Config ADC:
1. Set work with DMA.
2. Set start convert by external trigger and choose trigger source.
3. Set scan mode.
4. Set number of converting and queue.
3. Config timer for create trigger event on update.
4. Config DMA stream for ADC and enable interrupt on TC.
5. Config USART and DMA for Transmit function.
6. In DMA IRQ Handler config buffer and start transmission by enabling
DMA.
Steps of initialization system