MICROCHIP USB PD Demo Board User Guide
- June 9, 2024
- MICROCHIP
Table of Contents
MICROCHIP USB PD Demo Board
USB PD Demo Board
The USB PD Demo Board is a USB power delivery battery charger demo board featuring the ATSAMD21J18A microcontroller. The board includes a PKoB for USB programming/debugging, along with an Atmel ICE interface.
Board Overview
Two types of expansion headers are supported by the board. There is one Xplained Pro I/O header with a 4-pin Xplained Pro power header, and a mikroBUS click board connector. The battery charger’s SEPIC power supply can support the full 20V/5A 100W USB PD specification. The demo code supports the OLED1 Xplained Pro add-on board on extension header 1. This add-on board is optional but is a useful tool for debugging and charger status monitoring. The OLED1 Xplained Pro board can be purchased separately. The USB PD Demo Board is a USB power delivery battery charger demo board featuring the ATSAMD21J18A microcontroller. The board includes a PKoB for USB programming/debugging, along with an Atmel ICE interface. Two types of expansion headers are supported by the board. There is one Xplained Pro I/O header with a 4-pin Xplained Pro power header, and a mikro-BUS click board connector. The battery charger’s SEPIC power supply can support the full 20V/5A 100W USB PD specification.
Getting Started
- Verify the A) 5V Select Header has a jumper on the DBG side and the B) Reset Select has a jumper on the Boot side as shown below:
- A ) Jumper on left side
- B ) Jumper on bottom
- Download and launch MPLAB X IDE.
- Plug the debug USB into your computer and check that MPLAB X recognizes that the kit is connected.
- If the Power LED does not light up, check that the 5V select header is set to the correct source.
- Download the PSF folder from the GitHub site (https://github.com/MicrochipTech/PD_Sink_Battery_Charger_Demo) and unzip the folder.
- Open MPLAB X and click File > Open Project, then navigate to where you downloaded the file and go to the folder PSF_EVB_Sink > PSF > Demo > PSF_EVB_Sink > firmware and select the project file; PSF_EVB_Sink.x
- Select the programming tool : USB Type-C Demo Board-SN: XXX
- Build and program the demo code by pressing the button located on the
- Connect the positive side of a 12V battery to the battery terminal marked + and the negative side of the battery to the terminal marked -.
- Connect any USB PD capable charger to the USB-C connector to begin charging.
The demo code supports the OLED1 Xplained Pro add-on board on extension header
- This add-on board is optional but is a useful tool for debugging and charger status monitoring. The OLED1 Xplained Pro board can be purchased here: OLED1 Xplained Pro Board. Button 3 on the OLED1 board is used to switch between two display pages. On the first page, the battery charger status is shown (either Fault, Pre-condition, CC Mode, CV Mode, or Fully Charged). If a fault has occurred, it will display what type of fault it is. If there is no fault, it will display the battery SOC as a percentage. On page 2, the negotiated PD contract is displayed in terms of negotiated voltage and current.
Note : You may have to press the board reset button after plugging in the OLED1 board if the display does not work initially.
Figures 5 and 6 detail the different state and fault codes that are recognized by the charger state machine and will be displayed on the OLED1 board. A brief description of what each code means is given
Status Type | Integer Code | Description |
---|---|---|
FAULT | 0 | A fault has been detected |
PRECONDITIONING
|
1
| Battery voltage is too low for full current
charging
CCMODE
|
2
|
Constant current charge mode
CVMODE
|
3
|
Constant voltage charge mode
CHARGED| 4| Battery is fully charged
RECHARGE
|
5
|
Battery voltage has fallen since being charged
Charger state machine status codes
Fault Type | Integer Code | Description |
---|---|---|
GENERIC | 0 | Unknown fault |
NOSOURCE | 1 | No PD source is attached |
UVLO
|
2
|
Battery terminal voltage is too low
OVLO
|
3
|
Battery terminal voltage is too high
OVERTEMP| 4| Battery temperature is too high
UNDERTEMP| 5| Battery temperature is too low
Debug information is output to debug com port for the board. Using a terminal program, Tera Term, set to the correct COM port for the PD EVAL board and 115.2 KBaud, debug information will be printed to the terminal window as shown below.
Debug information shown below of the charging of the battery.
Calibration Procedure
Refer to page 7 of the user guide for calibration procedure details. An optional calibration procedure can be done to improve the accuracy of the charger current sense readings. A multimeter will be required for this process.
Steps to calibrate current readings:
- Construct the circuit shown in the diagram below.
- In the code file “SEPIC_CTRL.c” change the CALEN variable to 1 and reprogram the board to enable the calibration.
- Plug a PD power source in to the USB-C connector (not depicted below).
- Using the data visualizer in MPLAB X, enter the current (in mA) displayed on the multimeter. Doing this for two different values will enable us to calculate the necessary calibration parameters.
- These values are stored in EEPROM and the calibration only needs to be done once. You will have to repeat the calibration if you reprogram the board.
Charger Characteristics
Refer to page 8 of the user guide for charger characteristics details. The charger uses a constant current/constant voltage charge algorithm. There are three main states that the charger operates in, pre-condition, constant current charge, and constant voltage charge. The charger will enter pre- condition mode if it detects the battery voltage is too low to safely charge at full current. In this mode, charge current is limited to a few hundred milliamps. Once the charger detects the battery voltage is above the pre- charge cutoff threshold, it will ramp up current to the maximum allowed charge current. This value can be hard-coded by the user or can be set to automatically calculate based on the negotiated PD contract. The charger will continue to charge at constant current until the battery voltage nears its maximum voltage at which point it will enter constant voltage mode. In this mode, the charger checks the battery voltage every 500ms. If the voltage is above the maximum battery voltage, it will decrement current until it is at or slightly below that voltage threshold. This will maintain the battery voltage at a constant level. This process will continue until the charge current is below a specified cutoff current. At this point the charger will shutoff but will continue monitoring the battery and topping off the charge as needed.
The parameters for charger state thresholds can be tuned in the “SEPIC_CTRL.c” file. Several defines are used to establish battery parameters and desired thresholds/cutoffs
Additionally, the preferred charge current can be manually or automatically determined by modifying the code shown below.
Schematics
Schematics and Bill of Materials
Refer to pages 11-17 of the user guide for schematics and bill of materials
details.
PCB Print
Bill of Materials
References
- GitHub: Let’s build from here · GitHub
- GitHub - MicrochipTech/PD_Sink_Battery_Charger_Demo: Demo project for the PD Sink battery charger board
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>