AN205124 F²MC-8FX Family MB95200H/210H Series 8-Bit Microcontroller Battery Charger Reference Solution.pdf

AN205124
F²MC-8FX Family MB95200H/210H Series 8-Bit Microcontroller Battery Charger
Reference Solution
Associated Part Family: MB95200H/210H Series
This application note describes the features of a Power Tool Battery Charger demo board. The battery charger
solution is based on LPC MCU MB95F223K and MB39A132.
Contents
1
2
Introduction ............................................................... 1
Demo Platform.......................................................... 2
2.1 Platform .................................................................. 2
3
Features ................................................................... 3
3.1 Battery Insertion Detection ..................................... 3
3.2 Support 2, 3 and 4 Cell Battery Pack ...................... 3
3.3 Support Setting Charger Voltage ............................ 3
3.4 Support Setting Charger Current ............................ 3
3.5 LED Display the Charger Status ............................. 4
1
4
Hardware .................................................................. 4
4.1 System Block Diagram ........................................... 4
4.2 Schematic............................................................... 5
4.3 MCU Pin Assignment ............................................. 6
5
Firmware .................................................................. 7
5.1 Flowchart ................................................................ 7
5.2 Firmware Project .................................................... 8
6
Additional Information ............................................... 9
Document History............................................................ 10
Introduction
Power Tool Battery Charger Demo Board is used to charge the battery of handset. The battery charger solution is
based on LPC MCU MB95F223K and MB39A132. MB95F223K is a SOP16 package MCU, which integrates
composite timer, 8/10 A/D converter on chip. The MB39A132 is a DC/DC converter IC for charging Li-ion battery.
This demo set supports features below:

Battery insertion detection

2, 3 and 4 cell battery pack

Setting charger voltage

Setting charger current

LED display the charger status.
www.cypress.com
Document No. 002-05124 Rev. *A
1
MB95200H/210H Series Battery Charger Reference Solution
2
Demo Platform
Demo Platform of Battery Charger
2.1
Platform
Figure 1 shows the demo platform of battery charger. The red and green LEDs show the charger status.
Figure 1. Demo Platform
www.cypress.com
Document No. 002-05124 Rev.*A
2
MB95200H/210H Series Battery Charger Reference Solution
3
Features
Features of Battery Charger
3.1
Battery Insertion Detection
When battery insertion is detected, the charger checks the voltage and temperature of the inserted battery. The
charger is stopped if it is abnormal.
Charger stops the charge process and the red LED starts to flash when charger detects that battery type is
unmatched. Charger continues the charge process when a new battery is inserted.
3.2
Support 2, 3 and 4 Cell Battery Pack
Adjusting R11 and R12 can change the number of charger cell.
When R11 is unconnected and R12 is 0 Ω, the charger supports 2 cells.
When R11 is unconnected and R12 is unconnected, the charger supports 3 cells.
When R11 is 0 Ω and R12 is unconnected, the charger supports 4 cells.
The demo current status supports 3 cells.
3.3
Support Setting Charger Voltage
Upon the setting of cell number, R9 and R10 can be adjusted to change the charge voltage.
When NADJ3 >= 0.82, one cell charge voltage is 4.20 V.
When 0.48<= NADJ3 <= 0.78, one cell charge voltage is 4.35 V.
When 0 <= NADJ3 <= 0.18, one cell charge voltage is 4.00 V.
When 0.22 <= NADJ3 <= 0.44, one cell charge voltage is 2×5×NADJ3 V.
Now the demo R9 is 2 K and R10 is 12 K, one cell charge voltage is 4.2 V and the charger voltage is 12.6 V.
3.4
Support Setting Charger Current
Upon above setting, R15 and R16 can be adjusted to change the upper limit of charge current.
When NADJ2 >= 0.92, the upper limit of charge current is 2.85 A.
When 0 <= NADJ2 <= 0.88, the upper limit of charge current is 2× (5×NADJ2-0.075) A.
Now the demo R15 is 100 K and R16 is 24 K, the upper limit of charge current is 1.8 A.
www.cypress.com
Document No. 002-05124 Rev.*A
3
MB95200H/210H Series Battery Charger Reference Solution
3.5
LED Display the Charger Status
The demo has two LEDs: green LED and red LED.
The green LED keeps on showing that the charger enters standby mode when charging is started or the battery is
fully charged.
The green light flashes to show that the charger is charging.
The red LED keeps on showing that the charger detects an over temperature in battery.
The red LED flashes to show that the battery is unmatched.
Charger stops the charge process when the red LED lights on or flash. Charger continues the charge process when a
new battery is inserted or resumes to normal status.
4
Hardware
Hardware of Battery Charger
4.1
System Block Diagram
Figure 2 shows the demo system block diagram. The demo charger is developed based on MCU MB95F223K and
MB39A132.

MCU: AD module, switch control module and LED signal module

DC input

Charge manager

LED

Battery
Figure 2. System Block Diagram
www.cypress.com
Document No. 002-05124 Rev.*A
4
MB95200H/210H Series Battery Charger Reference Solution
4.2
Schematic
Figure 3 shows the schematic.
Figure 3. Battery Charger
www.cypress.com
Document No. 002-05124 Rev.*A
5
MB95200H/210H Series Battery Charger Reference Solution
4.3
MCU Pin Assignment
Table 1 shows the MB95F223K pin assignment in this system.
Table 1. Pin Assignment
Pin Number
Pin
Function
10
P01/INT01
AD input, VOUT
9
P02/INT02
AD input, CURRENT_DETECT
11
P03/INT03
AD input, BATTERY_DETECT
12
P04/INT04
AD input, TEMP_DETECT
13
P05/INT05
LED output, Green LED
14
P06/INT06
LED output, Red LED
15
P07/INT07
Switch output
www.cypress.com
Document No. 002-05124 Rev.*A
6
MB95200H/210H Series Battery Charger Reference Solution
5
Firmware
Firmware of Battery Charger
5.1
Flowchart
MCU initializes the on-chip peripherals and initializes the system parameters when the battery is detected and battery
temperature is normal.
When above status is normal, the system will entry charging process and continue to check the battery status and
temperature.
When the battery is fully charged, the charge process stops.
The description of main loop function is shown in Figure 4.
Figure 4. Main Loop Flowchart
Start
System initialization and green led on
Check Battery status ready?
N
Y
Check Temp status ready?
N
Y
Enter charge and green led flash
Y
N
Check Battery status ready?
Y
Check Temp status ready?
N
Y
Check Battery fully?
N
Y
Stop charge and green led on
www.cypress.com
Document No. 002-05124 Rev.*A
7
MB95200H/210H Series Battery Charger Reference Solution
5.2
Firmware Project
This demo uses MB95F223K to implement all the functions. MB2146-08-E and SOFTUNE V3 are used to debug the
demo.
The table below explains the functions of the main files.
Table 2. Battery Charger Function
Files
Function
ad.c
Detect battery type, temperature, current and voltage
Global.c
Define global variable
Handle.c
Function module
Main.c
Main function
Ma95200.asm
Cypress MCU head file
Startup.asm
MCU configure file
Timer0.c
System clock function
Vecter.c
Interrupt setting file
The project is shown in Figure 5.
Figure 5. Demo Project
www.cypress.com
Document No. 002-05124 Rev.*A
8
MB95200H/210H Series Battery Charger Reference Solution
6
Additional Information
For more information on Cypress products, visit the following website:
http://www.cypress.com/cypress-microcontrollers
www.cypress.com
Document No. 002-05124 Rev.*A
9
MB95200H/210H Series Battery Charger Reference Solution
Document History
Document Title: AN205124 – F²MC-8FX Family MB95200H/210H Series 8-Bit Microcontroller Battery Charger Reference
Solution
Document Number: 002-05124
Revision
ECN
Orig. of
Change
Submission
Date
**
-
HUAL
09/27/2010
Initial release
*A
5276162
HUAL
05/18/2016
Migrated Spansion Application Note MCU-AN-500100-E-10 to Cypress format.
www.cypress.com
Description of Change
Document No. 002-05124 Rev.*A
10
MB95200H/210H Series Battery Charger Reference Solution
Worldwide Sales and Design Support
Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find
the office closest to you, visit us at Cypress Locations.
PSoC® Solutions
Products
ARM® Cortex® Microcontrollers
cypress.com/arm
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP
Automotive
cypress.com/automotive
Cypress Developer Community
Clocks & Buffers
cypress.com/clocks
Interface
cypress.com/interface
Lighting & Power Control
cypress.com/powerpsoc
Memory
cypress.com/memory
PSoC
cypress.com/psoc
Touch Sensing
cypress.com/touch
USB Controllers
cypress.com/usb
Wireless/RF
cypress.com/wireless
Forums | Projects | Videos | Blogs | Training | Components
Technical Support
cypress.com/support
PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corporation. All other trademarks or registered trademarks
referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
Phone
Fax
Website
: 408-943-2600
: 408-943-4730
: www.cypress.com
© Cypress Semiconductor Corporation, 2010-2016. This document is the property of Cypress Semiconductor Corporation and its subsidiaries, including
Spansion LLC (“Cypress”). This document, including any software or firmware included or referenced in this document (“Software”), is owned by
Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such
laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other
intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with
Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to
sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for
use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end
users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of
Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for
use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD
TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. To the extent permitted by applicable law, Cypress reserves the right to
make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or
circuit described in this document. Any information provided in this document, including any sample design information or programming code, is
provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and
safety of any application made of this information and any resulting product. Cypress products are not designed, intended, or authorized for use as
critical components in systems designed or intended for the operation of weapons, weapons systems, nuclear installations, life-support devices or
systems, other medical devices or systems (including resuscitation equipment and surgical implants), pollution control or hazardous substances
management, or other uses where the failure of the device or system could cause personal injury, death, or property damage (“Unintended Uses”). A
critical component is any component of a device or system whose failure to perform can be reasonably expected to cause the failure of the device or
system, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim,
damage, or other liability arising from or related to all Unintended Uses of Cypress products. You shall indemnify and hold Cypress harmless from and
against all claims, costs, damages, and other liabilities, including claims for personal injury or death, arising from or related to any Unintended Uses of
Cypress products.
Cypress, the Cypress logo, Spansion, the Spansion logo, and combinations thereof, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or
registered trademarks of Cypress in the United States and other countries. For a more complete list of Cypress trademarks, visit cypress.com. Other
names and brands may be claimed as property of their respective owners.
www.cypress.com
Document No. 002-05124 Rev.*A
11