News
>
>
>
Hangshun HK32MCU (Lesson 10) I HK32F103xC/D/E's ADC processing mechanism when the normal and injection channels are triggered at the same time Application Notes (10)
Check category

Hangshun HK32MCU (Lesson 10) I HK32F103xC/D/E's ADC processing mechanism when the normal and injection channels are triggered at the same time Application Notes (10)

  • Categories:Group news
  • Author:shaodong
  • Origin:Hangshun chip
  • 2022.03.03

(Summary description)The ADC module realizes the accurate perception of the external world by the MCU through accurate measurement of the voltage and current signals, thereby realizing precise control of the application.

Hangshun HK32MCU (Lesson 10) I HK32F103xC/D/E's ADC processing mechanism when the normal and injection channels are triggered at the same time Application Notes (10)

(Summary description)The ADC module realizes the accurate perception of the external world by the MCU through accurate measurement of the voltage and current signals, thereby realizing precise control of the application.

  • 2022-03-03
Information

HK32F103x/C/D/E is a medium and large capacity series MCU launched by Hangshun chip. As a commonly used ADC module for 32-bit MCUs, it has many applications in various products, such as key detection applications that save I/O pins, and various sensors, such as light sensors, humidity sensors, temperature sensors, etc. The analog signal of the MCU is converted into a voltage and current signal, and the ADC module realizes the accurate perception of the external world by the MCU through accurate measurement of the voltage and current signal, thereby realizing the precise control of the application.

 

>>>>
Function description of ADC of HK32F103x/C/D/E:
The 12-bit ADC is a successive approximation analog-to-digital converter. It has up to 18 channels and can measure 16 external and 2 internal sources. A/D conversion for each channel can be performed in single, continuous scan or discontinuous mode. The result of the ADC can be stored in a 16-bit data register either left-aligned or right-aligned.

An analog watchdog feature allows the application to detect if the input voltage exceeds a user-defined high/low threshold.

The input clock of the ADC must not exceed 14MHz, which is generated by dividing the frequency of PCLK2.

 

>>>>
Main features of ADC of HK32F103x/C/D/E:

 

● 12-bit resolution

● Interrupt on end of conversion, end of injected conversion and analog watchdog event

● Single and continuous conversion modes

● Auto scan mode from channel 0 to channel n

● Self-calibration

● Data alignment with embedded data consistency

● The sampling interval can be programmed separately by channel

● Both rule transitions and injection transitions have external trigger options

● Discontinuous mode

● Dual mode (devices with 2 or more ADCs)

● ADC conversion time:

HK32F103xx Enhanced Products: 1μs at 56MHz (1.17μs at 72MHz)

● ADC power supply requirements: 2V to 5.5V

● ADC input range: VREF- ≤ VIN ≤ VREF+

Note: If there is a VREF- pin (depending on the package), it must be connected to VSSA

 

 

>>>>
Channel selection of ADC of HK32F103x/C/D/E:

 

There are 16 multiplexed channels. Transformations can be divided into two groups: rule groups and injection groups. A series of transitions in any order on any number of channels constitutes a group transition. For example, the conversion can be done in the following order: channel 3, channel 8, channel 2, channel 2, channel 0, channel 2, channel 2, channel 15.

● Rule groups

Consists of up to 16 transitions. The regular channels and their conversion order are selected in the ADC_SQRx registers. The total number of conversions in the rule set should be written to the L[3:0] bits of the ADC_SQR1 register.

● Injection group

Consists of up to 4 transitions. The injection channels and their conversion order are selected in the ADC_JSQR register. The total number of conversions injected into the group should be written into the L[1:0] bits of the ADC_JSQR register.

If the ADC_SQRx or ADC_JSQR registers are changed during a conversion, the current conversion is cleared and a new start pulse will be sent to the ADC to convert the newly selected bank.

 

>>>>

Temperature Sensor / VREFINT Internal Channel

The temperature sensor is connected to the channel ADC1_IN16, and the internal reference voltage VREFINT is connected to ADC1_IN17. The two inner channels can be converted by injection or regular channel.

Note: The temperature sensor and VREFINT can only be present in the main ADC1.

 

>>>>
The HK32F103x/C/D/E need to pay attention to the use of ADC
Problem Description:

When the working mode of the ADC is the combination sampling of the regular channel and the injection channel, they need to trigger sampling at the same time, that is, when the signal triggering sampling occurs at the same time, the regular channel sampling trigger signal of HK32F103 will be ignored, and the S** In this case, the T chip will first trigger the injection channel, and then trigger the regular channel to work. The following is an example of the case of Fail:

Set the bits 21 and 22 of the register ADC2->CR2 at the same time as above, that is, trigger the sampling of the regular channel and the injection channel at the same time, and the sampling trigger signal of the regular channel will be ignored.

Root cause:

The transition triggering mechanism is different in this case.

Solution:

Adjust the software so that the trigger signal does not trigger at the same time (same 1 clock cycle). Here is an example solution:

That is, the time-sharing trigger is used for sampling, and it is only necessary to ensure that the trigger is not triggered at the same time.

Keyword:

返回列表

推荐新闻

×

Product Center

Solution

About Us

Technical Support

Please let us know your contact details

Contact us

No. 159, North Pingji Avenue, Pinghu Street, Longgang District, Shenzhen

Heng Road E Times Hangshun Chip Headquarters Building 22nd Floor

86-0755-88917820(Shenzhen)

2880948126

Copyright © 2021 Shenzhen Hangshun Chip Technology R&D Co., Ltd.  粤ICP备13075796号-2