TB3097

TB3097
Digital SMPS – Buck Converter Using the PIC12F1501 NCO Peripheral
Author:
Ionut Veche
Microchip Technology Inc.
INTRODUCTION
The digital Switch Mode Power Supply (SMPS) is
practically an asynchronous buck converter controlled
by the PIC12F1501, and has a very high efficiency at
light loads. It also offers hardware output overvoltage
protection to avoid damaging the charged device.
The charger is characterized by a very small and
simple board and a very short Bill of Materials (BOM),
which make it very easy to understand and use.
BLOCK DIAGRAM
The control board provides closed-loop proportional
control in firmware to maintain the desired output
voltage and limit the output current. The PIC® device
(PIC12F1501) provides the necessary peripherals for
A/D conversion, PWM generation and the amount of
memory needed by the algorithm. The control-loop
update rate is 4 kHz; the update rate is limited by the
ADC acquisition speed.
Figure 1 illustrates the block diagram of SMPS.
FIGURE 1:
BLOCK DIAGRAM
9%DW
92XW
The features of the PIC12F1501 for this application
are:
/RDG
9
•
•
•
•
•
Two 10-bit ADC
One 5-bit DAC
One Comparator
One Numerically Controlled Oscillator (NCO)
One Complementary Waveform Generator
(CWG)
9LQ
3,&)
3:0
29SURWHFWLRQ
$XWR6KXWGRZQ
&:*
*QG
92XWBGLY
&203
1&2
'$&
92XWBGLY
All these features are connected into the proper
functions by software configuration.
PERFORMANCE SPECIFICATIONS
Electrical specifications over operating range:
8V ≤ VDD ≤ 16V.
TABLE 1:
ELECTRICAL SPECIFICATIONS
Input Voltage Range
Output Voltage
8-16
Volts DC
5
Volts DC
Output Current
2
Amperes
Output Power
10
Watts
Code Size
452
Words
Ram Size
31
Efficiency
88.5%
%XWWRQ
$'&
,6HQVH
The overvoltage protection is assured by the CWG
module, which is configured to shut down when the
output of the comparator is high. The input in the CWG
module is received from the NCO module, and the
output is CWG1A. Thus, the main purpose of the
CWG in this implementation is for auto-shutdown. The
NCO module is running in Pulse Frequency mode.
FIGURE 2:
EFFICIENCY
Bytes
Measured at 2A
Available Code Size
572
Words
Available RAM Size
33
Bytes
 2013 Microchip Technology Inc.
6:
/223
&21752/
DS90003097A-page 1
TB3097
FUNCTIONAL DESCRIPTION
APPLICATIONS
The power supply uses a PIC12F1501 for
implementing the proportional loop control. The
algorithm for adjusting the output voltage and current
is done in software, where the information about the
output voltage and the load current (10-bit ADC
channels) is used for controlling the closed loop. The
circuit uses the NCO peripheral to generate a fixed ontime, variable frequency control signal for a buck
converter. The “on time” is fixed to 2 µs and the duty
cycle is limited in firmware to about 90% at 450 kHz.
The NCO frequency step is about 16 Hz using a
16 MHz clock source.
The power supply uses digital proportional control for
regulating the output but the update rate is only 4 kHz.
This makes it slow to respond to sudden load variations
and input voltage changes. For this reason, output
voltage is clamped by a very fast comparator-based,
overvoltage protection mechanism.
The control loop modifies the NCO frequency
(essentially modifying duty cycle – fixed on-time,
different period) to regulate the converter output. The
decisions are made based on the ADC values read
from the output voltage resistor divider and the output
current shunt.
Since only one control loop is running for both voltage
and current regulation, a special function decides on
each update which of the two needs to be regulated. In
normal operating conditions, the control loop tries to
match the output voltage to the reference. If the output
current goes over the limit, the loop tries to match the
output current to the maximum-allowed value by
reducing the output voltage. A special counter prevents
erratic behavior when transitioning from one mode to
the other.
On the other hand, a digital power supply has huge
advantages. Output current and voltage can be
modified during run-time by the application and
complex algorithms like multi-step battery charging
algorithms can be easily implemented. The peripheral
configuration allows 15 bits of duty-cycle resolution for
the transistor control signal, which enables very fine
control of output voltage and current.
The main application areas of this power supply are
battery chargers, LED drivers, thermoelectric cell
drivers, programmable bias generators, and so on.
With an accurate voltage reference, the circuit is more
than adequate for charging sensitive Li-Ion batteries.
FIGURE 3:
DUTY CYCLE vs.
FREQUENCY USING FIXED
ON-TIME (PF MODE)
)UHT
N+=
'XW\&\FOH
)L[HGRQWLPH
XV
XV
3XOVH)UHTXHQF\0RGH
1&22XWSXW
DS90003097A-page 2
 2013 Microchip Technology Inc.
TB3097
MCU PERIPHERAL CONFIGURATION
DRAWING
The application only needs two analog channels (one
for output voltage and the other one for current sense)
for the loop control algorithm. The comparator input for
the overvoltage protection is configured on the same
pin as the output voltage ADC input.
At the run-time, the two programming pins (PGC and
PGD) can be used for other purposes, if required. The
configuration of the PIC12F1501 pins for implementing
the proportional control loop application is listed in the
following table (see Table 2):
TABLE 2:
Pin No.
PIC12F1501 PERIPHERAL
CONFIGURATION
Name
Function
1
VDD
Supply voltage
2
RA5
NCO channel used for providing
PWM signal for the proportional
control loop
3
AN3
Analog input used for reading
output voltage (VOUT) used in the
feedback loop
4
RA3
Digital input – this input will
provide start/stop functionality for
the control loop algorithm
5
AN2
Analog input used for reading the
current sense
6
PGC
Programming clock
7
PGD
Program data
8
VSS
Ground reference
 2013 Microchip Technology Inc.
DS90003097A-page 3
TB3097
PERIPHERAL CONFIGURATION
DS90003097A-page 4
FIGURE 4:
 2013 Microchip Technology Inc.
TB3097
SCOPE PLOTS OF KEY
PARAMETERS
POWERING THE DEMONSTRATION HW
The following table (see Table 3) contains some
characteristics of the charger obtained with an input of
14.3V and an output of 5V.
TABLE 3:
Sw. Frequency
(kHz)(3)
The output voltage (VOUT = 5V) is obtained at J2
connector and J4 connector (USB connector).
WHERE TO FIND THE CODE AND
SCHEMATICS
POWER SUPPLY
CHARACTERISTICS
Output
Current
(mA)(2)
The board is powered from the input J1 connector with
an input voltage between 8V and 16V.
Efficiency
(%)(1)
0
0.1-0.5
50
11
78.0
100
22
81.3
250
56
84.6
500
108
86.4
1000
184
87.6
1200
184
88.1
1400
184
88.5
1600
184
88.8
1800
184
88.8
2000
180
88.5
The
code
can
be
downloaded
from
www.microchip.com.
For a better understanding of the implemented
algorithm, please see the following flowchart diagram
(Figure 6):
FIGURE 6:
ALGORITHM FLOWCHART
Read ADC
channels
Control Loop
VOut > 5V
Current
regulation
Note 1: Efficiency is calculated including power
loss on current shunt.
Voltage
regulation
ISense > 2A
2: At 2A, the converter is running in current
limiting mode.
3: PWM is fixed on-time (2 µs) with variable
frequency.
FIGURE 5:
OPERATING FREQUENCY
vs. LOAD CURRENT
350 kHz
GLOSSARY
TABLE 4:
ACRONYMS
300 kHz
PWM
250 kHz
ADC
Analog-to-Digital Converter
200 kHz
DAC
Digital-to-Analog Converter
NCO
Numerically Controlled Oscillator
PID
Proportional Integral Derivative
14.3V Input
12V Input
150 kHz
9V Input
100 kHz
CWG
50 kHz
Pulse-Width Modulation
Complementary Waveform Generator
0 kHz
50 mA 100
mA
250
mA
500
mA
750
mA
1000 1200 1400 1600 1800 2000
mA
mA
mA
mA
mA
mA
Figure 5 shows the converter operating frequency for
14.3V, 12V and 9V input at different output currents.
Once the inductor current becomes continuous, the
frequency/duty cycle changes very little, only to
compensate for component power losses.
 2013 Microchip Technology Inc.
DS90003097A-page 5
TB3097
APPENDIX A:
FIGURE 7:
SCHEMATIC
Vbat
P2
C16
2
1
C19
10uF: 16V
C21
10uF: 16V
1uF: 16V
J1-Vbat
Vout
Vout
P1 J2-Out
1
2
GND
NTMS4177PR2G
8
7
6
5
L1
2
2
VDD
3
IN
4
GND
OUT
NC
15K
2
3
Murata 39S103C
Q3
PWM
15K
J4
1
1
PMEG3030EP
4
1
2
3
R1
C4
C5
C6
C9
C10
10uF
10uF
10uF
470uF: 10V
470uF: 10V
4
R8
R6
20K
10K
VBUS
DD+
GND
0
Vbat
R7
5
GND
C7
10nF
1
GND
MCP1416
ISENSE
GND
GND
R2
1K
R5
0R050: 1W
Vout
J5
6
GND
PGC
5
4
3
2
1
+5V
PGD
1
MCLR
+5V
S1
C17
100nF
PWM
Vout_Div
MCLR
SW-DPST
GND
U15
GND
2
3
4
Vdd
RA5
RA0/AN0/PGD
RA1/AN1/PGC
RA4/AN3
MCLR/VPP/RA3
RA2/AN2
Vss
7
6
5
PGC
ISENSE
8
Vout_Div
C8
1nF
R4
10K
PIC12F1501
GND
Vbat
R3
10K
PGD
GND
+5V
MCP1703
VOUT
2
GND
C2
1uF
VIN
C1
1uF
1
3
GND
DS90003097A-page 6
 2013 Microchip Technology Inc.
Note the following details of the code protection feature on Microchip devices:
•
Microchip products meet the specification contained in their particular Microchip Data Sheet.
•
Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the
intended manner and under normal conditions.
•
There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our
knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data
Sheets. Most likely, the person doing so is engaged in theft of intellectual property.
•
Microchip is willing to work with the customer who is concerned about the integrity of their code.
•
Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not
mean that we are guaranteeing the product as “unbreakable.”
Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of our
products. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such acts
allow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.
Information contained in this publication regarding device
applications and the like is provided only for your convenience
and may be superseded by updates. It is your responsibility to
ensure that your application meets with your specifications.
MICROCHIP MAKES NO REPRESENTATIONS OR
WARRANTIES OF ANY KIND WHETHER EXPRESS OR
IMPLIED, WRITTEN OR ORAL, STATUTORY OR
OTHERWISE, RELATED TO THE INFORMATION,
INCLUDING BUT NOT LIMITED TO ITS CONDITION,
QUALITY, PERFORMANCE, MERCHANTABILITY OR
FITNESS FOR PURPOSE. Microchip disclaims all liability
arising from this information and its use. Use of Microchip
devices in life support and/or safety applications is entirely at
the buyer’s risk, and the buyer agrees to defend, indemnify and
hold harmless Microchip from any and all damages, claims,
suits, or expenses resulting from such use. No licenses are
conveyed, implicitly or otherwise, under any Microchip
intellectual property rights.
Trademarks
The Microchip name and logo, the Microchip logo, dsPIC,
FlashFlex, KEELOQ, KEELOQ logo, MPLAB, PIC, PICmicro,
PICSTART, PIC32 logo, rfPIC, SST, SST Logo, SuperFlash
and UNI/O are registered trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
FilterLab, Hampshire, HI-TECH C, Linear Active Thermistor,
MTP, SEEVAL and The Embedded Control Solutions
Company are registered trademarks of Microchip Technology
Incorporated in the U.S.A.
Silicon Storage Technology is a registered trademark of
Microchip Technology Inc. in other countries.
Analog-for-the-Digital Age, Application Maestro, BodyCom,
chipKIT, chipKIT logo, CodeGuard, dsPICDEM,
dsPICDEM.net, dsPICworks, dsSPEAK, ECAN,
ECONOMONITOR, FanSense, HI-TIDE, In-Circuit Serial
Programming, ICSP, Mindi, MiWi, MPASM, MPF, MPLAB
Certified logo, MPLIB, MPLINK, mTouch, Omniscient Code
Generation, PICC, PICC-18, PICDEM, PICDEM.net, PICkit,
PICtail, REAL ICE, rfLAB, Select Mode, SQI, Serial Quad I/O,
Total Endurance, TSHARC, UniWinDriver, WiperLock, ZENA
and Z-Scale are trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries.
SQTP is a service mark of Microchip Technology Incorporated
in the U.S.A.
GestIC and ULPP are registered trademarks of Microchip
Technology Germany II GmbH & Co. KG, a subsidiary of
Microchip Technology Inc., in other countries.
All other trademarks mentioned herein are property of their
respective companies.
© 2013, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Printed on recycled paper.
ISBN: 9781620773741
QUALITY MANAGEMENT SYSTEM
CERTIFIED BY DNV
== ISO/TS 16949 ==
 2013 Microchip Technology Inc.
Microchip received ISO/TS-16949:2009 certification for its worldwide
headquarters, design and wafer fabrication facilities in Chandler and
Tempe, Arizona; Gresham, Oregon and design centers in California
and India. The Company’s quality system processes and procedures
are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchip’s quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS90003097A-page 7
Worldwide Sales and Service
AMERICAS
ASIA/PACIFIC
ASIA/PACIFIC
EUROPE
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://www.microchip.com/
support
Web Address:
www.microchip.com
Asia Pacific Office
Suites 3707-14, 37th Floor
Tower 6, The Gateway
Harbour City, Kowloon
Hong Kong
Tel: 852-2401-1200
Fax: 852-2401-3431
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Japan - Osaka
Tel: 81-6-6152-7160
Fax: 81-6-6152-9310
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8569-7000
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
China - Hangzhou
Tel: 86-571-2819-3187
Fax: 86-571-2819-3189
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
China - Hong Kong SAR
Tel: 852-2943-5100
Fax: 852-2401-3431
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
Taiwan - Hsin Chu
Tel: 886-3-5778-366
Fax: 886-3-5770-955
China - Shenzhen
Tel: 86-755-8864-2200
Fax: 86-755-8203-1760
Taiwan - Kaohsiung
Tel: 886-7-213-7828
Fax: 886-7-330-9305
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
Taiwan - Taipei
Tel: 886-2-2508-8600
Fax: 886-2-2508-0102
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
DS90003097A-page 8
Japan - Tokyo
Tel: 81-3-6880- 3770
Fax: 81-3-6880-3771
11/29/12
 2013 Microchip Technology Inc.