CN / EN
文档反馈
感谢关注汇顶文档,期待您的宝贵建议!
感谢您的反馈,祝您愉快!
无匹配项 共计114个匹配页面

Comparator

Introduction

The comparator compares two analog signals: V1 (input voltage) and V2 (reference voltage), and generates a rising edge interrupt when V1 exceeds V2 or falling edge interrupt when V1 is lower than V2. Here it is assumed that V1 is connected to the positive side of the comparator, and V2 is connected to the negative side of the comparator. It is worth noting that interrupts will also be triggered when V1 is already lower than V2 before the comparator is enabled, or V2 is reset to a value higher than V1. The interrupt can be used to wake the system up from sleep state. These two signals can be derived from any of the eight MSIOs (MSIO_0–MSIO_7). Additionally, the comparator can be used to compare an external signal with one of the following:

  • An internal programmable reference voltage.
  • A programmable divided version of VBATL.

Main Features

  • Input voltage (V1)
    • Internal reference voltage (Vref)
    • VBAT-based reference voltage (Vbat_ref), internal reference based on VBAT
    • Eight MSIOs (MSIO_0–MSIO_7)
  • Reference voltage (V2)
    • Internal reference voltage (Vref)
    • VBAT-based reference voltage (Vbat_ref), internal reference based on VBAT
    • Eight MSIOs (MSIO_0–MSIO_7)
  • Configurable 26 mV hysteresis
    • No hysteresis
    • –26 mV negative side of hysteresis
    • +26 mV positive side of hysteresis
    • Fully hysteresis 52mV (±26mV)
  • Res degeneration is set for calibration.
    • Negative side calibration of comparator
    • Positive side calibration of comparator
  • Bias current set (COMP_REG_0.ICOM_CTRL_3_0).
  • Comparator channel selection

Functional Description

Overview

The following figure shows the overview of the wakeup comparator module.

Figure 114 COMP overview

Once enabled by configuring theCOMP_REG_0.COMP_EN bit, the comparator starts to work. When the wakeup comparator module is started, V1 starts to be compared with V2 continuously. When V1 exceeds V2, the wakeup interrupt will be triggered. The COMP_REG_0.CHANNEL_SEL_P_3_0 and COMP_REG_0.CHANNEL_SEL_N_3_0 fields are used to select the input of V1 and V2. When Vbat_ref is selected in the COMP_REG_0.CHANNEL_SEL_N_3_0 or COMP_REG_0.CHANNEL_SEL_P_3_0 field, the bit COMP_REG_1.EN_VBAT_REF should be enabled first. The COMP_REG_0.COMP_BATT_LVL_CTRL_2_0 field is used to select a level value of Vbat_ref.

The following figure shows the settings of VBATT control level. The COMP_BATT_LVL_CTRL_2_0 level value ranges from 0 to 7, and the calculation formula of Vbatt_ref is shown below:



Figure 115 Set of Vbat_ref control level

When Vref is selected in the COMP_REG_0.CHANNEL_SEL_P_3_0 or COMP_REG_0.CHANNEL_SEL_N_3_0 field, the bit COMP_REG_1.EN_REF should be enabled first. The COMP_REG_0.COMP_REF_CTRL_7_0 field is used to select a level value of Vref. The settings of Vref control level is showed in the following figure. The COMP_REF_CTRL_7_0 level value ranges from 0 to 255 and can be configured by the COMP_REG_0.COMP_REF_CTRL_7_0 field. The calculation formula of Vref is shown below. Iref comes from the relatively constant current generated by the chip's bandgap module and will not be affected by other modules, as shown in the following figure.



Figure 116 Set of Vref control level
Note:

When Vref is selected as reference, to keep the Iref stable, the chip supply voltage (VBAT) must be equal to or higher than 2.5 V. A better suggestion is that the VBAT is equal to or higher than 3 V.

The selected analog pins will be acquired by the comparator once it is enabled.

Hysteresis

The configurable 52 mV (±26 mV) hysteresis could be added into the wakeup comparator, which helps ensure the slowly changing voltage or a slightly noisy voltage that will cause the comparator not to output to oscillate frequently when the two input voltages are almost close. This could increase the anti-interference ability of the comparator.

The hysteresis mode can be configured in COMP_REG_1.HYS_EN. The hysteresis on both sides mode is illustrated in Figure 117. The comparator will trigger a falling edge interrupt whenever V1 becomes lower than V2- (VHYST/2). It will also trigger a rising edge interrupt whenever V1 becomes higher than V2+ (VHYST/2). Here it is assumed that V1 is connected to the positive side of the comparator, and V2 is connected to the negative side of the comparator.

Figure 117 Both sides hysteresis enabled in wakeup comparator

Res Degeneration

Res degeneration is set for calibration. The default values of the COMP_REG_1.RDEG_N_3_0 field and the COMP_REG_1.RDEG_P_3_0 field are 0x8 and are always kept unchanged. The COMP module obtains positive and negative res degeneration which means users can calibrate the comparator by adjusting positive and negative sides. For example, when the comparator outputs a valid signal, the voltage values at N and P sides of the comparator should be approximately equal; if it is found that the actual voltage at P side is too much larger than that at N side, you can set the value of COMP_REG_1.RDEG_P_3_0 smaller, or set the value of COMP_REG_1.RDEG_N_3_0 larger.

CascRes Half

The COMP_REG_1.CASCRES_HALF bit is used to ensure that the comparator is in proper operation at different bias currents.

  • The COMP_REG_1.CASCRES_HALF is set to 1 for half resistor when COMP_REG_0.ICOMP_CTRL_3_0 is close to 0000.
  • The COMP_REG_1.CASCRES_HALF is set to 0 for full resistor when COMP_REG_0.ICOMP_CTRL_3_0 is close to 1111.

Bias Current Set

The COMP_REG_0. ICOMP_CTRL_3_0 field is used to configure the bias current. Higher bias currents will reduce the response time of the comparator, but with a corresponding increase in power consumption. Lower bias currents will increase the response time of the comparator, but with a corresponding reduce in power consumption. It is worth noting that this bias current is also from bandgap module, but this current and Iref are independent of each other and will not interfere with each other.

Glitch Remove

When the voltage reaches the threshold, the signal from the comp output will jitter because of noise interference. In order to eliminate jitter, users can specify a time by configuring the PMU_COMP_GLITCH_REMOVE.GLITCH_REMOVE_CYCLE field and the signal is considered valid if it does not change within this period of time. As the following figure shows, if the duration of the signal is less than the user set time Glitch_t, then the probability of triggering the interrupt will be greatly reduced. If the duration of the signal is larger than the user set time Glitch_t, then the interrupt will definitely be triggered.

Figure 118 Glitch removing of comp

Registers

COMP_REG_0

  • Name: Comparator Register 0
  • Description: This register includes REF_VALUE setting, COMP enablement, and channel selection.
  • Base Address: 0x4000A800
  • Offset: 0x40
  • Reset Value: 0x00000000
Table 664 Comparator Register 0
Bits Field Name RW Reset Description
31: 24 RSVD R Reserved bits

23:20

CHANNEL_SEL_N_3_0

WR

0x0

Wakeup comparator channel N selection:

  • 0–7: MSIO_0–MSIO_7
  • 8: GND
  • 9: Vbat_ref
  • 10: Vref

19:16

CHANNEL_SEL_P_3_0

WR

0x0

Wakeup comparator channel P selection:

  • 0–7: MSIO_0–MSIO_7
  • 8: GND
  • 9: Vbat_ref
  • 10: Vref

15:8

COMP_REF_CTRL_7_0

WR

0x0

COMP REF CTRL (Vref)

Changes the BG-based reference: Min = 0 V, Max =1.9 V (step = 9 mV).

  • 11111111: 1.9 V
  • 00000000: 0 V

7

COMP_EN

WR

0x0

Enables or disables wakeup comparator.

  • 0: Disable
  • 1: Enable

6:4

COMP_BATT_LVL_CTRL_2_0

WR

0x0

Changes the Vbat based ref (Vbat_vref):

  • 000: Vbat/10
  • 001: 2 Vbat/10

  • 111 :8 Vbat/10

3:0

ICOMP_CTRL_3_0

WR

0x0

  • 0000: Max current (1 μA)
  • 1111: Min current (50 nA)

COMP_REG_1

  • Name: Comparator Register 1
  • Description: This register includes res degeneration, reference source enable, CascRes Half, and Hysteresis.
  • Base Address: 0x4000A800
  • Offset: 0x44
  • Reset Value: 0x00000088
Table 665 Comparator Register 1
Bits Field Name RW Reset Description

15

EN_REF

WR

0x0

  • 1: Enable internal Vref.
  • 0: Disable internal Vref.

14

EN_VBAT_REF

WR

0x0

  • 1: Enable Vbat_ref.
  • 0: Disable Vbat_ref.

13

CASCRES_HALF

WR

0x0

CascRes Half:

  • 1: Half resistor (high power when ICOMP_CTRL_3_0 is close to 0000)
  • 0: Full resistor (low power when ICOMP_CTRL_3_0 is close to 1111)

12:10

RSVD

R

0x0

Reserved bits

9:8

HYS_EN

WR

0x0

  • 00: No hysteresis
  • 01: Positive Hysteresis only
  • 10: Negative Hysteresis only
  • 11: Hysteresis on both sides

Hysteresis = 26 mV

7:4

RDEG_N_3_0

WR

0x8

Res degeneration N, for calibration only

3:0

RDEG_P_3_0

WR

0x8

Res degeneration P, for calibration only

MCU_WKUP_CTRL

  • Name: MCU Wakeup Control Register of COMP
  • Description: For each bit, 0 indicates IRQ is disabled, and 1 indicates IRQ is enabled.
  • Base Address: 0x4000A000
  • Offset: 0x80
  • Reset Value: 0x0000FFFF
Table 666 MCU Wakeup Control Register of COMP
Bits Field Name RW Reset Description

5

EVT_PMU_MSIO_COMP

WR

0x1

  • 1: Enable the wakeup function of the comp rising edge.
  • 0: Disable the wakeup function of the comp rising edge.

AON_SLP_EVENT

  • Name: AON Sleep Event Register of COMP
  • Description: Events that happen in sleep or active mode, controlled by MCU_WKUP_CTRL.
Note:

When clearing the individual event, do not use read-mask-write but simply write ~ (1<< EVENT_BIT) to AON_SLP_EVENT.

  • Base Address: 0x4000A000
  • Offset: 0x84
  • Reset Value: 0x00000000
Table 667 AON Sleep Event Register of COMP
Bits Field Name RW Reset Description

5

EVT_PMU_MSIO_COMP

WR

0x0

Write 0 to this bit to clear comp event.

PMU_COMP_GLITCH_REMOVE

  • Name: COMP Glitch Remove Register
  • Description: To remove voltage jitter, add deglitch circuit on comparator output (glitch: from 4 μs to 28 μs at a 4 μs step).
  • Base Address: 0x4000A000
  • Offset: 0x2C0
  • Reset Value: 0x00000000
Table 668 COMP Glitch Remove Register
Bits Field Name RW Reset Description

31:3

RSVD

R

Reserved bits

2:0

GLITCH_REMOVE_CYCLE

WR

0

  • 0: No glitch removal
  • 1–7: 4 μs*N glitch removal

Electrical Specifications

In the table below, the typical values are measured at 25°C, and the minimum and maximum values are measured at the worst process and temperature conditions.

Table 669 Electrical specifications
Symbol Description Min. Typ. Max. Unit
VREF Internal reference voltage in wakeup comparator (when VBAT is equal to or higher than 3 V) 0 1900 mV
VBAT_REF Battery based reference voltage in wakeup comparator 0.1 * VBATL 0.8 * VBATL V
ERR_VREF The error rate of the Internal reference voltage (when VBAT is equal to or higher than 3 V) 1.3 5 %
ERR_VBAT_REF The error rate of the battery based reference voltage 1 5 %
P_HYS Positive hysteresis voltage in wakeup comparator 16 26 36 mV
N_HYS Negative hysteresis voltage in wakeup comparator 16 26 36 mV
T_RES Comparator response time 8 12 μs

扫描关注

打开微信,使用“扫一扫”即可关注。