STM32 Processor AD Difficulty finishing

Source: Internet
Author: User

1.stm32 ad changes, task groups can be converted into two groups: Rule groups and injection groups. Random sequences transform multiple channels in random order to form a set of transformations. For example. Be able to complete the conversion, for example in the following order: Channel 3, Channel 8, Channel 2, Channel 2, Channel 0, Channel 2, Channel 2, channel 15. In the Execute Rule Channel Group scan transformation. Change. It is possible to blur the conversion of an injected group into an ad-converted interrupt, where the conversion of a rule channel group is a normal conversion, while the conversion of the injected group will break the conversion of the rule group if the conversion condition of the injected group is met. Assume that the rule transformation is already in execution. In order to ensure synchronization after the injection conversion, the rule transitions for all ADCs (primary and slave) are stopped, and synchronous recovery occurs at the end of the injection conversion.

There are external triggering options for both the rule and injection transformations, and the DMA request is generated during the rule channel conversion, and the injection conversion has no DMA request, and the converted data needs to be saved in a query or interrupt manner.


2. Rule group: This mode is activated by setting the Discen bit on the ADC_CR1 register. It can be used to run a short sequence of n-Times conversions (n<=8). This conversion is part of the conversion sequence selected by the ADC_SQRX register. The value n is given by the discnum[2:0] bit of the ADC_CR1 register.

An external trigger signal can initiate the next round of n conversions in the ADC_SQRX register, until all of this sequence has been converted. The total sequence length is defined by the ADC_SQR1 Register's l[3:0].

Example: n=3, converted Channel = 0, 1, 2, 3, 6, 7, 9, 10 The first trigger: the sequence of conversions is 0, 1, 2 the second trigger: the sequence of conversions is 3, 6, 7 The third trigger: the sequence of conversions is 9, 10, and the EOC event is triggered the fourth time: the sequence of conversions 0, 1, 2, and so on.
Injection group: This mode is activated by setting the Jdiscen bit of the ADC_CR1 register.

After an external trigger event, the mode converts the sequence selected in the ADC_JSQR register, one at a time, in the order of the channels.

An external trigger signal can initiate the conversion of the next channel sequence selected by the ADC_JSQR register. Until all transitions in the sequence are complete. The total sequence length is defined by the jl[1:0] bit of the ADC_JSQR register.

Example: n=1, converted Channel = 1, 2, 3 first trigger: Channel 1 is converted the second trigger: Channel 2 is converted to the third trigger: Channel 3 is converted, and the EOC and JEOC events are generated for the fourth time: Channel 1 is converted. Also, in turn.

Operating mode of the 3.stm32 ADC:
One-time conversion mode: Once the conversion is stopped;
Continuous conversion Mode: The next conversion starts once the conversion is complete.
Scan mode: Scans a set of analog channels.
Discontinuous mode: once per trigger. Converts n channels in a sequence.


4. The value of the rule channel conversion is stored in a single data register. Therefore, it is necessary to use DMA when converting multiple rule channels, which avoids losing data that has already been stored in the ADC_DR register. Only the DMA request is generated at the end of the conversion of the regular channel, and the transformed data is transferred from the ADC_DR register to the user-specified destination address.
Note: Only ADC1 and ADC3 have DMA capabilities. The data converted by ADC2 can be transmitted using the DMA function of the ADC1 via the dual ADC mode.


5. Dual ADC Mode
(1) Synchronous injection mode: This mode converts an injection channel group. External triggering of the injection group multiplexer from the ADC1 (selected by the jextsel[2:0 of the ADC1_CR2 register). It provides synchronous triggering for ADC2 at the same time.
Note: Do not convert the same channel on 2 ADCs (two ADCs do not overlap on the same channel at the sample time).


(2) Synchronization rule mode: This mode runs on the Rule Channel group. The externally triggered rule group multi-switch (extsel[2:0 by the ADC1_CR2 Register) from ADC1, which provides synchronous triggering for ADC2 at the same time.


(3) High-speed crossover mode: This mode is only available for rule channel groups (usually one channel). External triggering of a regular channel multi-switch from ADC1.

After the external trigger is generated:
A.ADC2 starts right away and
B.ADC1 starts after 7 ADC clock cycles are delayed
Note: The maximum consent takes the sample time <7 a ADCCLK cycle. Avoid overlapping of two sample cycles when ADC1 and ADC2 convert the same channel.


(4) Slow crossover mode: This mode is only available for rule channel groups (only one channel).

External triggering of a regular channel multi-switch from ADC1. After the external trigger is generated:
A.ADC2 starts right away and
B.ADC1 starts after 14 ADC clock cycles are delayed
C. After delaying the second 14 ADC cycles, the ADC2 starts again, so it loops.
(5) Alternate trigger mode: This mode is only suitable for injection channel groups.

The external trigger source is an injection channel multi-switch from the ADC1.
A. When the first trigger is generated, all injected group channels on the ADC1 are converted.
B. When a second trigger arrives. All injected group channels on the ADC2 are converted.
C. This cycle ...
(6) Standalone mode: in this mode. Dual ADC synchronization does not work, and each ADC interface works independently of each other.


(7) Mixed rule/injection synchronization mode: The Rule Group Synchronization transformation can be interrupted to initiate a synchronous conversion of the injected group.
(8) Mixed synchronization rule + alternating trigger mode: The Rule Group Synchronization transformation can be interrupted to initiate an injection group alternating trigger transformation. Shows a rule that the synchronous transition is interrupted by an alternating trigger.


(9) Mixed synchronous injection + Crossover mode: An injection event can interrupt a cross-conversion. Such a case. The crossover conversion is interrupted, note at the beginning of the conversion, inserted at one end of the injection sequence, and cross-conversion recovery.

Copyright notice: This article blog original article. Blogs, without consent, may not be reproduced.

STM32 Processor AD Difficulty finishing

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.