ADC of stm32f767


1. Basic introduction

1, ADC clock.

The ADC clock is usually derived from the APB2 clock divided by a programmable prescaler that allows the ADC to operate at f PCLK2 /2, /4 , /6 or /8 .  ADCCLK maximum limit.

2, ADC channel.

     There are 16 multiplexing channels. My understanding is that each ADC (1, 2, 3) has 16 channel inputs, but corresponding to the external IO port, ADC123 is shared, that is, the IO input by the external ADC is not 16*3, and most of the three ADCs multiplex these IO ports.
Transformations can be divided into two groups: regular transformations and injected transformations.
A regular transformation group consists of up to 16 transformations.
An injection transformation group consists of up to 4 transformations.
Temperature Sensor, V REFINT , and V BAT Internal Channels
The temperature sensor is internally connected to channel ADC1_IN18 shared with VBAT . Only one conversion can be selected at a time (warm
degree sensor or VBAT ). When the temperature sensor and VBAT conversion are set at the same time , only VBAT conversion will be performed.
The internal reference voltage VREFINT is connected to ADC1_IN17 .
The V BAT channel is connected to the ADC1_IN18 channel. This channel can also be converted into an injection channel or a regular channel.

The difference between the rule channel and the injection channel is still not fully understood, explained online

Regular channel:

Equivalent to a normal running program,

Inject channel:

It is equivalent to an "interruption", which interrupts the ongoing rule channel, so as to carry out the procedure of injecting the channel. After the injection channel completes the conversion, then continue to complete the conversion of the regular channel.

3. ADC trigger mode

It can be divided into software trigger and external trigger.

Software trigger means that the control register triggers an ADC conversion.

External trigger, the conversion can be triggered by external events (for example, timer capture, EXTI interrupt line), and the use of timer trigger is an external trigger.

 trigger source

 

 

 

 

For the advanced timer tim1, tim8 has TRGO2 in addition to TRGO.

 4. ADC conversion time

The minimum number of clocks required to take a sample.

 

 Sampling time can be set.

5. ADC sampling frequency

Sampling frequency, such as using a timer trigger, the trigger frequency is the sampling frequency of the ADC, and the conversion time of the ADC limits the maximum sampling frequency.

6. ADC working mode

 One-shot conversion mode , in single-conversion mode, the ADC performs one conversion.

Continuous conversion mode, in continuous conversion mode, ADC starts a new conversion immediately after finishing one conversion.

Scan mode (Scan mode), this mode is used to scan a group of analog channels.

Two, stm32Cube IDE, software trigger single measurement setting

 

Three, program.

Initialization, in addition to the automatically generated initialization function, plus the function to turn on the ADC

 HAL_ADC_Start(&hadc1);

 test

 uint32_t adc_value =  HAL_ADC_GetValue(&hadc1);

Reference article:

(3 messages) [STM32] HAL library-ADC_Yiyi L's blog-CSDN blog_adc of hal library

Guess you like

Origin blog.csdn.net/m0_38012497/article/details/128234490#comments_25711877