Here are some examples of how to set the hysteresis voltage of a comparator.
Conditions: VDD = 3.3 V, VREF = 1.4 V, hysteresis width = 6 mV, rise detection voltage 1.650 V
1) R3 rate
In order to minimize the influence of the input leakage voltage, it is necessary to pass a current of at least 0.5 µA to R3. The current flowing to R3 is (VREF − VOUT)/IR3, with VOUT = 0 V or VOUT = VDD, so you can obtain the rate by calculating R3 = VREF/IR3 or R3 = (VDD − VREF)/IR3.
The smaller of the two results is used. When VDD = 3.3 V, VREF = 1.4 V and IR3 = 1 µA, the two resistance rates are 1.4 MΩ and 1.9 MΩ, so our choice here is 1.4 MΩ.
2) Hysteresis width
VHB will be 6 mV in this case.
3) R1 rate
R1 = R3 (VHB/VDD)
R1 = 1.4M (6m/3.3) = 2.55 kΩ
Set the rise detection point of VTHR so that VTHR > VREF(R1 + R3)/R3 is satisfied. It will be 1.650 V in this case.
5) R2 rate
R2 = 1/(VTHR/(VREF⋅R1) − (1/R1) − (1/R3))
= 1/(1.65/(1.4⋅2.55k) − (1/2.55k) − (1/1.4M))
= 14.4 kΩ
The rise and fall time and hysteresis width are as follows:
Rise time: VTHR = VREF⋅R1(1/R1 + 1/R2 + 1/R3)
Fall time: VTHF = VTHR − R1⋅VCC/R3
Hysteresis: VHB = VTHR − VTHF = R1⋅VCC/R3