SLAA476B February   2011  – July 2019 BQ2040 , BQ2040 , BQ2060A , BQ2060A , BQ2063 , BQ2063 , BQ2083-V1P3 , BQ2083-V1P3 , BQ2084-V143 , BQ2084-V143 , BQ2084-V150 , BQ2084-V150 , BQ2085-V1P3 , BQ2085-V1P3 , BQ20Z40-R1 , BQ20Z40-R1 , BQ20Z70-V160 , BQ20Z70-V160 , BQ20Z80A-V110 , BQ20Z80A-V110 , BQ28400 , BQ28400 , BQ78PL114 , BQ78PL114 , BQ78PL116 , BQ78PL116 , LM5145 , LM5145 , MSP430F5500 , MSP430F5500 , MSP430F5501 , MSP430F5501 , MSP430F5502 , MSP430F5502 , MSP430F5503 , MSP430F5503 , MSP430F5504 , MSP430F5504 , MSP430F5505 , MSP430F5505 , MSP430F5506 , MSP430F5506 , MSP430F5507 , MSP430F5507 , MSP430F5508 , MSP430F5508 , MSP430F5509 , MSP430F5509 , MSP430F5510 , MSP430F5510 , TPS40057 , TPS40057 , TPS40170 , TPS40170

 

  1.   Wide-Vin Battery Charger Using SMBus Communication Interface Between MSP430™ MCUs and bq Fuel Gauges
    1.     Trademarks
    2. Introduction
    3. Hardware
      1. 2.1 Overall System Description
      2. 2.2 MSP430F5510 Daughterboard Subsystem
        1. 2.2.1 Subsystem Description
        2. 2.2.2 MSP430F5510 Port Pins Functionality Description
      3. 2.3 Power Stage Board Subsystem
        1. 2.3.1 Subsystem Description
        2. 2.3.2 Input Protection Features
        3. 2.3.3 Constant-Voltage and Constant-Current Feedback
    4. Software
      1. 3.1 SMBus Protocol Description
      2. 3.2 Software File Structure
      3. 3.3 API Calls Description
        1. 3.3.1  UCS_Init ( )
        2. 3.3.2  Timer_Init ( )
        3. 3.3.3  PWM_Init ( )
        4. 3.3.4  ADC_Init ( )
        5. 3.3.5  Fan_Init ( )
        6. 3.3.6  LED_Init ( )
        7. 3.3.7  SMBus_Initialize ( )
        8. 3.3.8  LED_Control ( )
        9. 3.3.9  Fan_Control ( )
        10. 3.3.10 VI_ADC_Read ( )
        11. 3.3.11 SMBus_Select ( )
        12. 3.3.12 Calibrate_Battery ( )
        13. 3.3.13 Delay_Timer ( )
        14. 3.3.14 PWM_Control ( )
        15. 3.3.15 Smbus_Access ( )
        16. 3.3.16 Smbus_Access_PEC ( )
        17. 3.3.17 crc8MakeBitwise ( )
      4. 3.4 Sample Application Description
    5. SBS Supported Commands Using SMBus Protocol
    6. Detailed Sample Application Flow Chart
    7. Battery Status Register Description
      1. 6.1 BatteryStatus (0x16)
    8. MSP430F5510 Daughterboard Schematics
    9. Setting Up the MSP430F5510 Daughterboard Hardware
      1. 8.1 JTAG FET Debugger Interface (Power Up, Program and Debug Options)
      2. 8.2 eZ430 Emulator Interface (Power Up, Program and Debug Options)
      3. 8.3 Power Stage Board (Power Up Option Only)
    10. Battery Calibration Circuit Setup
    11. 10 Battery Voltage and PWM Conversions
    12. 11 Battery Current and PWM Conversions
    13. 12 Power Stage Board Schematics (Generation 1: 40-V Input)
    14. 13 Bode Plot Measurement for Feedback Loop Stability Analysis
    15. 14 Power Stage Board Schematics (Generation 2: 60-V Input)
    16. 15 Setting Up the Power Stage Board Hardware
    17. 16 References
  2.   Revision History

Software File Structure

This section describes the organization of the software code file structure.

  • main.c – Contains the main() function. The file also contains other functions such as:
Name Brief Description
Battery_Charger_Controller() Implements the demo reference design software flow chart.
Initialize_Battery_Definitions() Initializes the hardware to charge two smart batteries simultaneously.
Get_Battery_Charger_SMBus_ Parameters() Interrogates the battery fuel gauge for the desired charging voltage, desired charging current, and other parameters.
Safety_Checks_Primary_SMBus() Compares the parameters received through SMBus against a set of limits to check whether the nominal operating values have been exceeded or not.
Safety_Checks_Secondary_ADC() Compares the parameters received through ADC conversions against a set of limits to check whether the nominal operating values have been exceeded or not.
Set_LED_Indicator_Status() Set the hardware LEDs to indicate status such as charging, fully charged or error condition.
Interrupt Service Routines (ISRs) ISRs for Timer, I2C/SMBus USCI, ADC10, and other peripherals
  • init.c – Functions for initializing modules/peripherals on the controller board:
Name Brief Description
UCS_Init() Initializes the clock system within the MSP430F5510.
Timer_Init() Initializes the timer.
PWM_Init() Initializes the PWM outputs.
ADC_Init() Initializes the ADC for voltage/current conversions.
  • init.h – Header file that contains device and controller board specific constants. The constants defined in this file should be used during structure declaration.
  • led.c – These functions control the operation of the status LEDs on the controller board.
Name Brief Description
LED_Init() Initializes the LEDs on the board.
LED_Control() Set the LEDs to a steady on/off state or set the LEDs to blink with an adjustable period.
  • led.h – Header file that defines the constants used in functions within the LED.c source file.
  • pwm.c – Functions that control the PWM duty cycle output to the charger board.
  • pwm.h – Constants associated with the functions defined in pwm.c source file.
  • smbus.c – Source code that uses the I2C USCI module for SMBus communication.
Name Brief Description
SMBus_Initialize() Initializes the SMBus communication lines with the option to configure the MSP430F5510 in master or slave mode.
SMBus_Access() Configures the MSP430F5510 in master mode and interrogates the battery fuel gauge with the user-specified command.
SMBus_Access_PEC() Configures the MSP430F5510 in master mode and interrogates the battery fuel gauge with the user-specified command with packet-error-checking (PEC).
SMBus_Select() Selects which battery channel to send the SMBus commands to.
crc8MakeBitwise() Implements the CRC-8 algorithm to compute the PEC byte.
  • smbus.h – Header file with SMBus related constants and definitions.
  • misc.c – Source file with miscellaneous functions.
Name Brief Description
Fan_Init() Initializes the fan structure.
Fan_Control() Turns the fan on or off.
VI_ADC_Read() Reads the voltage or current using the ADC.
Calibrate_Battery() Turns on or off the calibration resistor circuitry.
Delay_Timer() Generic delay function.
  • misc.h – Header file with constants and definitions used in misc.c source file.
  • device.h – Header file for target device declaration.
  • F5XX_6XX_Core_Lib – This folder contains code files for configuring the power management module (PMM) within the MSP430F5510. These source code files are derived from an external set of Hardware Abstraction Libraries (HAL) for the 5xx and 6xx series of devices [7].
    • hal_pmm.c – Function library for setting the PMM VCore voltage level. To operate the DCO that drives the SMCLK at a higher or lower frequency, the VCore level must be raised up or lowered down by calling these functions.
    • hal_pmm.h – Header file with function declarations and constants.
  • demo.c – Demo functions that exemplify API function call usage.
  • demo.h – Header file with function call prototypes declared in demo.c source file.
  • NOTE

    The files demo.c and demo.h should be excluded from the project settings when compiling/building the sample application software. These files are provided for example purposes only.