STM32: Triggering the ADC from a Timer.

STM32: Triggering the ADC from a Timer.
STM32

The other day I needed to start an ADC conversion once per second, and it immediately became clear that this can't be done with the SMPR[2:1] bits, which set the number of cycles between ADC samples, so I had to find another way. The maximum number of cycles between samples that can be set with these bits is 239.5. If you add the conversion time of 12.5...

STM32: Storing ADC Data with DMA.

STM32: Storing ADC Data with DMA.
STM32

DMA (Direct Memory Access) lets you transfer data without involving the core. That is, if you use DMA, then when an ADC conversion completes, we don't need to fetch the conversion result and store it in memory; DMA will do it for us. To do this, when configuring DMA it's enough to specify the address to take data from and where to store it, plus a few more simple settings...

STM32 ADC.

STM32 ADC.
STM32

Let's look at the features of the ADC in STM32. 12-bit resolution; reference voltage from 2.4 to 3.6 volts; sampling rate up to 1MSPS; 18 channels (16 external and 2 internal: reference voltage and temperature sensor); interrupt at the end of regular and injected conversions; interrupt from the window comparator (Analog watchdog); DMA transfer for regular...