Zero-dead corner game stm32-read excerpt 3

Source: Internet
Author: User

I. ADC (DMA mode)

1. clock frequency settings

The maximum clock frequency of the CPU is 72 MHz, while that of the ADC module is 14 MHz. To achieve the maximum clock frequency of the ADC module, the maximum CPU frequency can only be set to 14 m x 4 = 56 m. (The commonly used clock frequency of pclk2 is 72 MHz, and the adcclk must be lower than 14 MHz. Therefore, in this case, the maximum frequency of adcclk is the 8-frequency division of pclk2, that is, adcclk = 9 MHz. If you want to enable the ADC to run at the highest frequency of 14 MHz, you can configure pclk2 to 56 MHz, and then obtain adcclk by dividing the 4-Digit Frequency .) You can't have both of them! In addition, when using USB, the system clock must be 48 MHz or 72 MHz. In this case, the maximum clock frequency of the ADC module is 48 MHz.
/4 = 12 MHz or 72 MHz/6 = 12 MHz, that is, the maximum sampling rate of the ADC is 857 K/s.

The value of the adc_sampletime parameter is used to configure the sampling period of the current channel. The minimum value can be set to 1.5 sampling periods. The period here refers to the adcclk clock period.

ADC sampling time calculation formula:
Tconv = sampling period + 12.5 cycles
The sampling period in the formula is the adc_sampletime configured in this function, and the 12.5 periods added after the formula are fixed values.

2. self-calibration

Before starting the ADC conversion, you need to start the self-calibration of the ADC. The ADC has a built-in self-calibration mode, which greatly reduces the accuracy error caused by changes in the internal capacitor group. An Error Correction Code (numerical value) is calculated on each capacitor during calibration, which is used to eliminate errors produced on each capacitor in subsequent conversions.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.