+ All Categories
Home > Documents > HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application...

HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application...

Date post: 20-Aug-2020
Category:
Upload: others
View: 8 times
Download: 0 times
Share this document with a friend
19
HT8 MCU OVP/OUVP&OCP Application Note AN0485E V1.00 1 / 19 June 19, 2018 HT8 MCU OVP/OUVP&OCP Application Note D/N: AN0485E Introduction Holtek 8-bit Flash MCUs such as the HT45FxN series devices have fully integrated Over Current Protection (OCP), Over Voltage Protection (OVP), Over and Under Voltage Protection (OUVP) and other protection circuits. These devices will find excellent use in power management applications such as power banks and battery chargers in addition to many others. This application note will introduce the characteristics and methods of how to use the integrated protection circuits, which will assist users to develop their applications. Functional Description OVP Protection Module The MCU integrated Over Voltage Protection (OVP) module consists of a comparator and a D/A converter which is used to generate a comparator reference voltage. For charge and discharge management, it can detect voltage changes quickly and trigger a protection mechanism immediately. As the protection module has an enable function, when the MCU enters the SLEEP mode, it can be disabled to reduce power consumption. The comparator in the OVP module has hysteresis and output filter functions which can filter out input small signal changes to reduce output jitter. Taking the HT45F4MA as an example, the OVP circuit is shown in the red box below:
Transcript
Page 1: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 1 / 19 June 19, 2018

HT8 MCU OVP/OUVP&OCP Application Note

D/N: AN0485E

Introduction Holtek 8-bit Flash MCUs such as the HT45FxN series devices have fully integrated Over

Current Protection (OCP), Over Voltage Protection (OVP), Over and Under Voltage

Protection (OUVP) and other protection circuits. These devices will find excellent use in

power management applications such as power banks and battery chargers in addition to

many others. This application note will introduce the characteristics and methods of how to

use the integrated protection circuits, which will assist users to develop their applications.

Functional Description

OVP Protection Module

The MCU integrated Over Voltage Protection (OVP) module consists of a comparator and

a D/A converter which is used to generate a comparator reference voltage. For charge

and discharge management, it can detect voltage changes quickly and trigger a

protection mechanism immediately. As the protection module has an enable function,

when the MCU enters the SLEEP mode, it can be disabled to reduce power consumption.

The comparator in the OVP module has hysteresis and output filter functions which can

filter out input small signal changes to reduce output jitter.

Taking the HT45F4MA as an example, the OVP circuit is shown in the red box below:

Page 2: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 2 / 19 June 19, 2018

OVP Register Description

Here, the overall operation of the OVP is controlled using several registers. These are the

OVPREF, OCVPR0, OCVPR1, OCVPR3 and OCVPR5 registers.

RegisterName

Bit 7 6 5 4 3 2 1 0

OVPREF — — OVPR5 OVPR4 OVPR3 OVPR2 OVPR1 OVPR0 OCVPR0 OCPEN OVPEN OCP1EN OCP0EN OVP1EN OVP0EN CHYBEN CHYAEN OCVPR1 OPAMC OVPC OCPC — DBB1 DBB0 DBA1 DBA0 OCVPR3 CAOFM CARS CAOF5 CAOF4 CAOF3 CAOF2 CAOF1 CAOF0 OCVPR5 — — — — — AX CBX CAX

OVPREF Register

OVPREF register is used to set the OVP reference voltage.

OVP reference voltage = (DAPWR/64) × OVPR[5:0], where OVPR is the OVPREF

register content in decimal notation.

OCVPR0 Register

Bit6, bit3, bit2 and bit0 in the OCVPR0 register are used to enable the OVP circuit and

its back-end protection circuits.

OCVPR1 Register

Bit6 and bit1~bit0 in the OCVPR1 register are used to control the OVP pin function

and debounce time.

OCVPR3 Register

The OCVPR3 register is used to control the OVP input offset voltage calibration.

OCVPR5 Register

Bit0 in the OCVPR5 register is used to read the logical output level of the OVP

comparator A.

Page 3: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 3 / 19 June 19, 2018

OVP Circuit Electrical Characteristics

In the OVP circuit, the comparator operating current is about 450µA@5V. The

comparator input offset voltage is ±4mV after calibration. The OVP circuit has a

hysteresis function with a typical voltage of 40mV. The input maximum common mode

voltage is VDD-1.4V. In the following table, Ta=25°C:

Symbol Parameter Test Conditions

Min. Typ. Max. Unit VDD Condition

IOVP Over Voltage Protection Operating Current

3V OVPEN=1

— 300 500 µA

5V — 450 600

VOS Input Offset Voltage 5V Without calibration, CAOF[5:0]=100000B -15 — -15

mV With calibration -4 — -4

VHYS Hysteresis Voltage 5V — 20 40 60 mV

VCM Common Mode Voltage Range 5V — VSS — VDD-1.4 V

DNL DAC Differential Nonlinearity 5V D/A converter reference voltage=VDD — — ±1 LSB

INL DAC Integral Nonlinearity 5V D/A converter reference voltage=VDD — — ±2 LSB

OVP Application Description

Software Configuration

Set the 6-bit D/A converter output voltage using the OVPR[5:0] bits in the OVPREF

register, then output to the OVP comparator A negative input terminal.

Set bit6 in the OCVPR0 register high to enable the OVP circuit.

When the OVP input voltage is greater than the OVP comparator reference voltage,

the comparator A output will change from “0” to “1”. The protection circuit will turn

the related PWM to an off state and generate an interrupt to inform the MCU. The

protection circuit settings depend on the OCVPR0 register.

Considerations for use

For example, in power bank applications, during battery discharging, if the load is

suddenly removed, the resulting change from a heavy load to a light-load, will

cause the output voltage to increase sharply. If the PWM control response is too

slow, this resulting high output voltage could possibly damage the IC. In such

cases, it is recommended to use the OVP function which will turn off the PWM

output and also the voltage output. Users must reduce the PWM duty in the

interrupt subroutine before turning on the PWM output.

In applications which use the 2.5V voltage as the A/D converter and OVP reference

voltage, the test voltage is usually provided after being divided by a resistor divider.

The voltage then enters the OVP input pin after filtering through a capacitor. The

resistance and capacitance values should be selected according to the actual OVP

hardware response speed to ensure the RC constant meets the requirements.

Page 4: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 4 / 19 June 19, 2018

OVP Comparator Input Offset Voltage Calibration Function

CARS CAOFM S1 S2 S3 0 0 ON ON OFF 0 1 OFF ON ON 1 0 ON ON OFF 1 1 ON OFF ON

The calibration steps are as follows:

Set CAOFM=1 to setup the offset cancellation mode, here S3 is off.

Set CARS to select the reference voltage input pin – S1 or S2 are off.

Adjust CAOF0~CAOF5 bits until the output status changes.

Set CAOFM=0 to restore the normal comparator A mode.

OUVP Protection Module

The MCU integrated the Over and Under Voltage Protection (OUVP) module consists of

two comparators and two D/A converters which are used to generate the reference

voltage. For charge and discharge management, it can detect voltage changes quickly

and trigger a protection mechanism immediately. As the protection module has an enable

function, if the MCU enters the SLEEP mode, it can be disabled to reduce power

consumption. The comparator in the OUVP module has hysteresis and output filter

functions, which can filter out small input signal changes to reduce output jitter.

Taking the HT45F4N as an example, the OUVP circuit is shown below.

Page 5: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 5 / 19 June 19, 2018

OUVP Register Description

Here, the overall operation of the OUVP is controlled using several registers. These are

the OVPDA, UVPDA, OUVPC0, OUVPC1, OUVPC2 registers.

Register Name

Bit

7 6 5 4 3 2 1 0

OVPDA D7 D6 D5 D4 D3 D2 D1 D0 UVPDA D7 D6 D5 D4 D3 D2 D1 D0 OUVPC0 OVPCX OUVPPC1 OUVPPC0 OVPCHY — OUVPRV OVPDB1 OVPDB0 OUVPC1 UVPCX OVPEN UVPEN UVPCHY — — UVPDB1 UVPDB0 OUVPC2 UVP1LEN UVP1HEN UVP0LEN UVP0HEN OVP1LEN OVP1HEN OVP0LEN OVP0HEN

OVPDA Register

The OVPDA register is used to set the OVP reference voltage.

OVP D/A converter output=(D/A converter reference voltage)×(DAC.7~0)/256.

UVPDA Register

The UVPDA register is used to set the UVP reference voltage.

UVP D/A converter output=(D/A converter output)×(DAC.7~0)/256.

OUVPC0 Register

The OUVPPC1~OUVPPC0 bits are used to select the OUVP input pin. The OUVPRV

bit is used to select the D/A converter reference voltage. The OVPDB1~OVPDB0 bits

are used to select the OVP comparator debounce time.

OUVPC1 Register

The OVPEN and UVPEN bits are the OVP and UVP enable control bits respectively.

The UVPDB1~UVPDB0 bits are used to select the UVP comparator debounce time.

OUVPC2 Register

The OUVPC2 register is used to set whether the corresponding OUTnL or OUTnH

output is forced into an off state when the OUVP protection function is triggered.

OUVP Circuit Electrical Characteristics

Here, in the OUVP circuit, the comparator operating current is about 450µA@5V. The

maximum input offset voltage of the comparator is ±10mV. The OUVP circuit has a

hysteresis function with a typical voltage of 40mV. The input maximum common mode

voltage is VDD-1.4V. In the following table shows, Ta=25°C:

Symbol Parameter Test Conditions

Min. Typ. Max. Unit VDD Condition

IOVP Over Voltage Protection Operating Current

3V OVPEN=1

— 300 500 µA

5V — 450 600

IUVP Under Voltage Protection Operating Current

3V UVPEN=1

— 300 500 µA

5V — 450 600 VOS Input Offset Voltage 5V — -10 — 10 mV VHYS Hysteresis Voltage 5V — 20 40 60 mV

VCM Common Mode Voltage Range 5V — VSS — VDD-1.4 V

DNL D/A Converter Differential Nonlinearity 5V D/A converter reference

voltage=VDD — — ±1 LSB

INL D/A Converter Integral Nonlinearity 5V D/A converter reference

voltage=VDD — — ±2 LSB

Page 6: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 6 / 19 June 19, 2018

OUVP Application Description

Software Configuration

Set bit6 or bit5 in the OUVPC1 register high to enable the OUVP circuit. Set bit6

and bit5 in the OUVPC0 register to select the OUVP input pin. Set the OUVPC2

register to select which output is forced into an off state when the protection

function is triggered.

The OVP circuit can set the 8-bit D/A converter by the OVPDA register, then output

to the OVP comparator negative input terminal.

The UVP circuit can set the 8-bit D/A converter by the UVPDA register, then output

to the UVP comparator positive input terminal.

When the OUVP input voltage is greater than the OVP comparator reference

voltage, the OVP comparator output will change from “0” to “1”. The protection

circuit will turn the related PWM to an off state and generate an interrupt to inform

the MCU. The protection circuit settings depend on the OUVPC2 register.

When the OUVP input voltage is less than the UVP comparator reference voltage,

the UVP comparator will change from “0” to “1”. The protection circuit will turn the

related PWM to an off state and generate an interrupt to inform the MCU. The

protection circuit settings depend on the OUVPC2 register.

Considerations for use

When the MCU PWM is used together with DC-DC buck/boost circuit to generate a

step-down/step-up voltage, it is recommended to use the OVP and UVP functions,

producing a more immediate output voltage response.

For example, in power bank applications, during battery discharging, if the load is

suddenly removed, the resulting change from a heavy load to a light load will cause

the output voltage increase sharply. If the PWM control response is too slow, this

resulting high output voltage could possibly damage the IC. In such cases, it is

recommended to use the OVP function which will turn off the PWM output and also

the voltage output. Users must reduce the PWM duty in the interrupt subroutine

before turning on the PWM output.

When the load is connected, the load will suddenly change from a light load to a

heavy load, which will reduce the output voltage. In such cases, it is recommended

to use the UVP function. When the voltage is stepped-down to a set value by the

load, an MCU UVP interrupt will be triggered. Users must increase the PWM duty

in the interrupt subroutine to increase the output voltage, to improve the dynamic

response performance.

In applications which use a 2.5V voltage as the A/D converter, OVP and UVP

reference voltage, the test voltage is usually provided after being divided by a

resistor divider. The voltage then enters the OVP or UVP input pin after filtering

through a capacitor. The resistance and capacitance values should be selected

according to the actual OVP or UVP hardware response speed to ensure the RC

constant meets the requirements.

Page 7: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 7 / 19 June 19, 2018

OCP Protection Module

The MCU integrated the Over Current Protection (OCP) module consists of an

Operational Amplifier, a comparator and a D/A converter which is used to generate the

reference voltage.

In charge and discharge management, the charge/discharge current is converted to a

small voltage signal using a sampling resistance and an input to the OCP pin. The signal

is amplified by the internal OPA, after which it is connected to the internal comparator

positive input terminal to quickly determine whether a short or hardware over current has

occurred. It is also connected to the A/D converter channel for conversion. The current

value is determined by A/D converter sampling.

The integrated OPA gain circuit can be set as the input signal non-inverting/inverting

amplification with the corresponding gain configurations using registers. The comparator

in the OCP module has hysteresis and output filter functions, which can filter out small

input signal changes to reduce output jitter.

Taking the HT45F4N as an example, the OCP circuit is shown below.

OCP Register Description

The overall operation of the OCP is controlled using several registers. These are the

OCPPC, OCPnC0, OCPnC1 and OCPnDA registers.

Register Name

Bit

7 6 5 4 3 2 1 0

OCPPC — — OCP1RV OCP0RV OCP11C OCP10C OCP01C OCP00C OCPnC0 OCPnM1 OCPnM0 OCPnPC1 OCPnPC0 OCPn1LEN OCPn1HEN OCPn0LEN OCPn0HEN OCPnC1 OCPnO OCPnCHY OCPnG2 OCPnG1 OCPnG0 OCPnF2 OCPnF1 OCPnF0 OCPnDA UVPCX OVPEN UVPEN UVPCHY — — UVPDB1 UVPDB0 AnCAL AnOFM AnRS AnOF5 AnOF4 AnOF3 AnOF2 AnOF1 AnOF0 CnCAL OCPnCX CnOFM CnRS CnOF4 CnOF3 CnOF2 CnOF1 CnOF0

OCPPC Register

The OCPnRV bit is used to select OCPn reference voltage, the OCP11C~OCP00C

bits are used to define the input pins.

Page 8: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 8 / 19 June 19, 2018

OCPnC0 Register

The OCPnM1~OCPnM0 bits are used to set the OCPn operating mode. The

OCPnPC1~CPnPC0 bits are used to control the OCPn input pin. The OCPnmLEN and

OCPnmHEN bits are used to enable the corresponding OUTmL and OUTmH.

OCPnC1 Register

The OCPnG2~OCPnG0 bits are used to set the OPA gain. The OCPnF2~OCPnF0

bits are used to set OCPn demodulation filter.

OCPnDA Register

The OCPnDA register is used to set OCPn reference voltage.

OCPn D/A converter output=(D/A converter output)×(DAC.7~0)/256.

AnCAL Register

The AnCAL register is used to set OCPn OPA offset calibration.

CnCAL Register

The CnCAL register is used to set OCPn comparator offset calibration.

OCP Circuit Electrical Characteristics

Here, the maximum input offset voltage of the OCP operational amplifier and OCP

comparator are both ±15mV. The input offset voltages can be calibrated within a range of

±4mV by programming an internal register. The maximum input common mode voltage is

VDD-1.4V. The comparator in OCP module has a hysteresis function with a typical voltage

of 40mV. In the following table shows, Ta=25°C.

Symbol Parameter Test Conditions

Min. Typ. Max. Unit VDD Condition

IOCP Over Current Protection Operating Current

3V OCPnM[1:0]=01B or 10B, D/A converter reference voltage=2.5V

— 300 500 μA

5V — 450 600

VOS_CMP Comparator Input Offset Voltage 5V

Without calibration, CnOF[4:0]=10000B -15 — 15 mV

With calibration -4 — 4 mV

VHYS Comparator Hysteresis Voltage 5V — 20 40 60 mV

VCM_CMP Comparator Common Mode Voltage Range

5V — VSS — VDD-1.4 V

VOS_OPA OPA Input Offset Voltage 5V Without calibration, AnOF[5:0]=100000B -15 — 15 mV

With calibration -4 — 4 mV

VCM_OPA OPA Common Mode Voltage Range

5V — -0.4 — VDD-1.4 V

DNL D/A Converter Differential Nonlinearity 5V D/A converter reference

voltage=VDD — — ±1 LSB

INL D/A Converter Integral Nonlinearity 5V D/A converter reference

voltage =VDD — — ±2 LSB

Page 9: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 9 / 19 June 19, 2018

OCP Application Description

OCP non-inverting amplify settings

When VIN > 0, PGA is configured in non-inverting mode by setting the OCPnM[1:0]

bits in the OCPnC0 register. The output voltage of PGA is

VOPGA = (1+R2/R1) × VIN

The OCP input source is select by setting the OCPnPC[1:0] bits in the OCPnC0

register.

The OPA gain is the ratio of R2/R1 and can be selected to ×1/×5/×10/×15/×20 by

setting the OCPnC1 register.

The OCP circuit uses the 8-bit D/A converter to generate an OCP reference

voltage which is then it is connected to the comparator negative input terminal.

The OCP input voltage is amplified by an OPA. If the amplified voltage is greater

than the 8-bit D/A converter comparison voltage, the OCP comparator output will

change from “0” to “1”. The protection circuit will turn the related PWM to an off

state and generate an interrupt to inform the MCU. The protection circuit settings

depend upon the OCPnC0 register.

Considerations for use:

When the OPA operates the in non-inverting amplifier mode, the OCP pin can be

connected to a low pass filter, which is implemented by connecting a resistor in

series and a capacitor in parallel to ground. However, it should be noted that the

RC response time of this filter circuit should not be too long, otherwise the OCP

response speed will be too slow.

OCP inverting amplify settings

When 0 > VIN > -0.4V, the PGA is configured in the inverting mode by setting the

OCPnM[1:0] bits in the OCPnC0 register. The output voltage of PGA is

VOPGA = - (R2/R1) × VIN

The OCP input source is select by setting the OCPnPC[1:0] bits in the OCPnC0

register.

The OPA gain is the ratio of R2/R1 which can be selected to ×1/×5/×10/×15/×20 by

setting the OCPnC1 register.

The OCP circuit uses the 8-bit D/A converter to generate an OCP reference

voltage which is connected to the comparator negative input terminal.

The OCP input voltage is amplified by an OPA. If the amplified voltage is greater

than the 8-bit D/A converter comparison voltage, the OCP comparator output will

change from “0” to “1”. The protection circuit will turn the related PWM to an off

state and generate an interrupt to inform the MCU. The protection circuit settings

depend on the OCPnC0 register.

Considerations for use:

In inverting amplification, the input voltage of the OPA negative input should not be

less than -0.4V to avoid an incorrect amplified output voltage, which is caused by

the internal protection diode of the negative input pin generating a leakage current.

Page 10: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 10 / 19 June 19, 2018

When the OPA operates in the inverting amplifier mode, the OCP pin is directly

connected to the resistor R1 and the OPA gain is the ratio of R2/R1. Here the

circuit should not be connected in series with an external filter resistor R_ex,

otherwise it will result in a distorted OPA gain of R2/(R+R_ex).

OCP OPA Input Offset Voltage Calibration

The OCP OPA has an input offset voltage, Vos, which will be added to the input signal

and output after amplifying. This will affect the accuracy of the output voltage. Therefore,

the MCU provides related registers which are used to calibrate the offset voltage. Two

general calibration methods will be introduced below.

Bilateral Calibration Method

Set OCPnM1~OCPnM0=11, AnOFM=1, the OCP will enter the OPA input offset

voltage calibration

Set AnOF[5:0]=000000 then read OCPnCX bit.

Let AnOF[5:0]=AnOF[5:0]+1 then read the OCPnCX bit, if OCPnCX has changed;

record the AnOF[5:0] data as VOS1.

Set AnOF [5:0]=111111 then read the OCPnCX bit.

Let AnOF[5:0]=AnOF[5:0]-1 then read the OCPnCX bit, if OCPnCX has changed;

record the AnOF[5:0] data as VOS2.

Restore VOS=(VOS1+VOS2)/2 to AnOF[5:0], the calibration is finished.

Unilateral Calibration Method

When the OPC input signal is too small, if the OPA adopts the bilateral calibration

method to calibrate the offset voltage within a range of ±4mV, it still does not meet the

requirements. The unilateral output base value calibration method can be adopted to

eliminate an error caused by VOS, thus small signals are amplified better.

Shut down the load (PWM OFF), initialise the A/D converter and select the channel

from the OCP input.

The OPA is configured in the non-inverting/inverting amplifier mode, the AnRS bit

is used to select the corresponding OPA input pin.

Set AnOF[5:0]=111111.

Let AnCAL=AnCAL-1.

Use the A/D converter to read the OPA output, if the A/D converter output value is

less than 100 then repeat AnCAL=AnCAL-1 until the A/D converter output value is

greater than 100, then go to the next step.

Record this A/D converter output value as the base value of no-load.

Shut up the load (PWM ON), the OPA output value is read by A/D converter, minus

the base value of no-load is the actual power consumption current.

Page 11: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 11 / 19 June 19, 2018

OCP Comparator Input Offset Voltage Calibration

When the OCP comparator is without calibration, the OCP comparator input offset

voltage, VOS, is less than or equal to ±15mV while it can be less than or equal to ±4mV

after calibrating using internal register. Therefore the comparator adopts a bilateral

calibration method.

Set OCPnM1~OCPnM0=11, CnOFM=1, the OCP will enter the comparator input

offset voltage calibration

Set CnOF[4:0]=00000 then read OCPnCX bit.

Let CnOF[4:0]=CnOF[4:0]+1 then read OCPnCX bit, if OCPnCX is changed; record

the CnOF[4:0] data as VOS1.

Set CnOF[4:0]=11111 then read OCPnCX bit.

Let CnOF[4:0]=CnOF[4:0]-1 then read the OCPnCX bit, if OCPnCX has changed;

record the CnOF[4:0] data as VOS2.

Restore VOS=(VOS1+VOS2)/2 to CnOF[4:0], the calibration is finished.

Hardware Description According to the above description, a single cell lithium battery charged using the

HT45F4N will be taken as an example to introduce the application methods of the OUVP

and OCP functions.

The complete circuit consists of an MCU power supply circuit, an adapter

insertion/removal detection circuit, a Buck/Boost synchronous rectifier circuit consisting of

P-MOS, N-MOS and L1, a battery voltage detection circuit, precision reference voltage

circuit and a protection circuit. The protection circuit includes OUVP and OCP functions.

The circuit compositions are shown in the following diagrams for reference.

Page 12: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 12 / 19 June 19, 2018

MCU Power Supply

The power supply circuit selects a higher voltage between +5V and BAT+ through two

SS14 schottky diodes to provide power to the MCU.

Adapter Insertion/Removal Detection

When the USB_IN1 interface is inserted into the adapter, PA6 will change from low to high.

Poll this pin status and start the charging operation if it changes to high.

When the adapter on the USB_IN1 interface is removed, PA6 will change from high to

low. Poll this pin status and stop the charging operation if it changes to low.

Input Voltage Detection - charging mode

The detection circuitry can detect an external voltage. If the external voltage is greater

than 5.5V, the hardware can force the PWM to an off status, stop charging and generate

an interrupt for related processing.

Buck/Boost Synchronous Rectifier Circuit

When a lithium battery is charging, the circuit operates in the buck mode using an

MT4953 PMOS transistor as the main switch. When the MT4953 PMOS transistor is on,

and the MT9926 NMOS transistor is off, the adapter charges the battery through the

PMOS and stores energy to inductor L1 simultaneously. When the MT4953 PMOS

transistor is off, the MT9926 NMOS transistor is on for freewheeling. The inductor L1

releases its stored electricity to continue battery charging.

The HT45F4N provides two complementary PWM outputs whose signals are sourced

from the TM1 output, TP1 or the TM2 output, TP2. They will pass through a dead time

insertion circuit, which can generate the complementary PWM outputs, PWMnH and

PWMnL with a dead time. The PWMnH output drives the P-MOS transistor while the

PWMnL output drives the N-MOS transistor. These two MOS transistors are used to drive

the charge current or discharge voltage during charging or discharging respectively. The

accompanying block diagram shows the structure of the complementary PWM with dead

time.

Complementary PWM Output Block Diagram

Page 13: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 13 / 19 June 19, 2018

Complementary PWM Output Waveform

Battery Voltage Detection

Battery charging has three steps, trickle current charge, constant current charge and

constant voltage charge. The MCU needs to detect the battery voltage to determine the

battery charging step according to the present voltage.

Battery Voltage Detection - OCP

During the charging process, the battery charge current will be converted into a voltage

signal by two small resistors RS1 and RS2 in parallel. This voltage signal is positive

relative to the MCU ground. The OCP operates using non-inverting amplification. The

voltage signal is connected to the OCP00 channel of OCP0 and amplified by the OCP

integrated OPA. After amplification, the signal is sampled by the A/D converter through

the internal channel after which the current is analysed. In addition, the signal is

connected to the internal OCP comparator positive input. If it is greater than the

comparator negative input voltage provided by the 8-bit D/A converter, the internal circuit

will automatically turn off the PWM signal and stop charging.

Precision Reference Voltage Circuit

To ensure that the measurement accuracy of the battery voltage and current, the A/D

converter and D/A converter in the MCU use 2.5V as a reference voltage which is

provided by an external voltage reference circuit TL431 with an error of 1%.

Software Description

According to the above description and taking the HT45F4N as an example, a single cell

lithium battery charging program is used as an example. It includes a main program and

some subroutines such as system initialisation, adapter status detection, lithium battery

Page 14: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 14 / 19 June 19, 2018

charging, temperature protection and many others. The lithium battery charging

subroutine includes the OUVP setup, OCP0 OPA input offset voltage unilateral output

base value calibration and comparator input offset voltage bilateral calibration for user

reference.

Main Flowchart Description

The main program determines the type of MCU reset by examining the TO and PDF flags.

If the MCU is woken up by a WDT reset, the adapter status detection subroutine will be

executed. The main program loop is executed to start charging after checking the adapter

has been re-inserted. If the MCU is reset in other ways, the main program loop is

executed after the system is initialised, implementing an adapter state detection, battery

voltage detection, temperature protection, system sleep processing and other programs.

The MCU can enter the SLEEP mode when there is no charge management to minimise

power consumption.

The main flowchart is as follows:

Power on

TO=1?&& PDF=1?

N

Y

Enter SLEEP?

N

Charge initializationAdapter is re-inserted or removed ? Y

Y HALT

MCU initialization

N

N

A/D converter sampling

Charge initializationAdapter is re-inserted or removed ?

N

Charge subroutine

NTC detection subroutine

1ms?

Y

5ms?

Y

N

Y

N

Page 15: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 15 / 19 June 19, 2018

Charging Flowchart Description

There are several charging flowchart main functions: when a battery voltage of less than

3V is detected, the battery will be charged with an 80mA trickle constant (80mA). If the

battery voltage is between 3V and 4.2V, then the battery will be charged with a constant

current (CC). If the battery voltage is greater or equal to 4.2V, then the battery will be

charged with a constant voltage (CV). Charging will be complete when the charge current

is less than 100mA. Here the charging flag will be cleared to zero. The device then will

stop charging and enter the power-down mode. The charging flowchart is as follows:

Charge

Y

Battery voltage< 3V mode?

N

Y

Return

Chargingcurrent <100mA?

CC charging mode?

N

Y

N

CV charging mode?

80mA chargingBattery voltage< 3V?

Change to CC charging modeN

Battery voltage<4.2V? Y

Change to CV charging modeN

Y

1A charging

Y Charge full, finish charging

Charging flag=1?

N

Page 16: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 16 / 19 June 19, 2018

OCP0 OPA Input Offset Voltage Calibration

Taking the HT45F4N OCP0 OPA unilateral outputs base value calibration method as an

example. The flowchart is as follows:

OPA unilateral calibration

OCP0 ADC SW INITIAL(A/D Converter initial, OCP00 as input source, non-inverting amplifier mode, Gain=20)

A0CAL=00111111B

A0OFM==1?

N

Y

ADC samples offset valuesV_OCP0_OPA_OFFSET

Return

A0CAL=00111111B

Y

V_OCP0_OPA_OFFSET>=100? N A0CAL-1

Page 17: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 17 / 19 June 19, 2018

OCP0 Comparator Input Offset Voltage Calibration

Taking the HT45F4N OCP0 comparator bilateral input offset voltage calibration method

as an example. The flowchart is as follows:

CP calibration

OCPPC=00000001B;(Reference source: AVDD,

input: OCP00)OCP0C0=11100011B;(Calibration method)

A0OFM=0;C0CAL=01100000B;(CP calibration)

F_OCPCX=OCP0CX;(Save OCP0CX status)

Compare OCP0CX with F_OCPCX; status is changed?

Y

N C0CAL++;C0RS==0?

N

V_VOOS1=C0CAL&00011111B(Save C0CAL value)

C0CAL=01111111BF_OCPCX=OCP0CX;

(Save OCP0CX status)

N

V_VOOS1+=C0CAL&00011111BC0CAL=V_VOOS1>>1;

(Compute the mean and save it to C0CAL)

Y

Return

Y

N C0CAL--;C0RS==0? YCompare OCP0CX with F_OCPCX;

Status is changed?

Page 18: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 18 / 19 June 19, 2018

Program Examples Program examples for Holtek HT8 standard instruction set MCUs: V3C language examples.

HT45F4N_CHG(4C37H+5EBBH).zip

Conclusion This application note has summarised the OVP, OUVP and OCP functions and also provided

considerations for use in addition to program examples to help users use these functions

more effectively.

Versions and Modification Information

Date Author Issue and Modification

2018.4.19 王思梅 First Version

Reference File

For more information refer to the Holtek’s official website http://www.holtek.com/en/.

Disclaimer All information, trademarks, logos, graphics, videos, audio clips, links and other items

appearing on this website ('Information') are for reference only and is subject to change at

any time without prior notice and at the discretion of Holtek Semiconductor Inc.

(hereinafter 'Holtek', 'the company', 'us', 'we' or 'our'). Whilst Holtek endeavors to ensure

the accuracy of the Information on this website, no express or implied warranty is given

by Holtek to the accuracy of the Information. Holtek shall bear no responsibility for any

incorrectness or leakage.

Holtek shall not be liable for any damages (including but not limited to computer virus,

system problems or data loss) whatsoever arising in using or in connection with the use of

this website by any party. There may be links in this area, which allow you to visit the

websites of other companies. These websites are not controlled by Holtek. Holtek will

bear no responsibility and no guarantee to whatsoever Information displayed at such sites.

Hyperlinks to other websites are at your own risk.

Page 19: HT8 MCU OVP/OUVP&OCP Application Note - Holtek · 2018. 6. 25. · HT8 MCU OVP/OUVP&OCP Application Note. AN0485E V1.00 3 / 19 June 19, 2018 . OVP Circuit Electrical Characteristics

HT8 MCU OVP/OUVP&OCP Application Note

AN0485E V1.00 19 / 19 June 19, 2018

Limitation of Liability

In any case, the Company has no need to take responsibility for any loss or damage

caused when anyone visits the website directly or indirectly and uses the contents,

information or service on the website.

Governing Law

This disclaimer is subjected to the laws of the Republic of China and under the jurisdiction

of the Court of the Republic of China.

Update of Disclaimer

Holtek reserves the right to update the Disclaimer at any time with or without prior notice,

all changes are effective immediately upon posting to the website.


Recommended