Skip navigation
Home > All Places > USB > EZ-PD Type-C USB > Blog > 2019 > June

Below steps for make a firmware for CCG3PA Power Adapter/Car Charger (1C+1A) single chip solution based on example firmware CYPD3171-24LQXQ_cla.


1. New created a project based on firmware source code CYPD3171-24LQXQ_cla.

a. Click File > New > Project, and select Ez-PD CCGx Power SDK (CCG3PA) as Target kit.

b. Select Code Example:CYPD3171-24LQXQ_cla.

c. Create a new work-space and choose a name and location for the design. (Since the target part number is going to use CYPD3175, so that I named it start with CYPD3175.)

NOW, the new project is created complete.


2. Clean the project as per CY4532 hardware schematic before start your new project if the hardware is not totally same as CY4532.

a. Change the part number of cc bootloader.

(1) Add a cc bootloader project into the workspace. (There are two types of cc bootloader, cc_sink_boot.cydsn and cc_src_boot.cydsn. cc_sink_boot.cydsn will present as power sink role with this bootloader after entering boot mode. cc_src_boot.cydsn will present as power source role with this bootloader after entering boot mode. )

(2) Change the part number of cc bootloader to make sure the bootloader project and application project use same project.

(3) Re-build cc bootloader project and update Bootloadable dependencies HEX and ELF files.

b. Clean application project.

(1) Type-C Port

Disable BUCK_BOOST_EN_C on TopDesign.cysch. Comment out or delete relates functions/operation of BUCK_BOOST_EN_C.

(2) Type-A Port

Disable PWM_A, BUCK_BOOST_EN_A, and TYPE_A_VBUS_EN. And open type_a.c and config.h files for cleaning firmware.

@file type_a.c.

Comment out line#55 - line#62

clear functions:

void type_a_enable_sdp(void)

static void type_a_enable_boost(void)

static void type_a_disable_boost(void)

void type_a_reg_switch_timer_cb(uint8_t instance, timer_id_t id)

void type_a_set_volt_timer_cbk(uint8_t port, timer_id_t id)

void type_a_set_voltage(uint16_t volt_mV)


@file config.h


@file stack_prarams.h

/* Dual regulator support for TYPE-A VBUS. */

//1C+1A #define TYPE_A_DUAL_REG_ENABLE                  (1u)


NOW, the firmware project is cleared. The project can verified on the board with Type-C port directly.


3. Add functions as per application.

a. Add a I2C Master/Slave in CCG3PA.

b. Use GPIO for Type-A VBUS current sense. Below function is example for using P2.3 for Type-A current sensing.


uint16_t Read_PortA_Current(void)


    uint8_t level;

    uint16_t current_volt;


    /* Configure GPIO. */

    hsiom_set_config(GPIO_PORT_2_PIN_3, HSIOM_MODE_AMUXA);

    /* Take ADC sample. */

    level = pd_adc_sample (0, PD_ADC_ID_1, PD_ADC_INPUT_AMUX_A);

    current_volt = pd_adc_level_to_volt (0, PD_ADC_ID_1, level);


    hsiom_set_config(GPIO_PORT_2_PIN_3, HSIOM_MODE_GPIO);


    return current_volt;



c. Add state machine for Type-A and Type-C power source capabilities. Below APIs can be refer to mask Type-C or Type-A power source capabilities.



* @brief This function updates the source PDOs at runtime thereby overriding

* the source PDOs in the config table.

* @param port Port index.

* @param count Count of PDOs.

* @param pdo Pointer to the PDO array.

* @return CCG_STAT_SUCCESS if operation is successful, CCG_STAT_BAD_PARAM

* otherwise.


ccg_status_t dpm_update_src_cap(uint8_t port, uint8_t count, pd_do_t* pdo);




* @brief This function updates the source PDO mask at runtime thereby

* overriding the source PDO mask in the config table.

* @param port Port index.

* @param mask PDO mask.

* @return CCG_STAT_SUCCESS if operation is successful, CCG_STAT_BAD_PARAM

* otherwise.


ccg_status_t dpm_update_src_cap_mask(uint8_t port, uint8_t mask);



* @brief This function updates the battery charging configuration.

* This is valid only if LEGACY_DYN_CFG_ENABLE macro is enabled. The configuration

* can only be updated when the BC state machine is stopped. Also note that

* bc_init() shall reload the configuration from the table.


* @param cport Battery Charging port index.

* @param chg_cfg Pointer to structure containing new configuration.


* @return ccg_status_t


ccg_status_t bc_set_config(uint8_t cport, chg_cfg_params_t *chg_cfg);

CCG3PA Power Adapter/Car Charger reference design in Type-C reference designs (LINK: ) is below structure as per the reference design name and link.


1. CCG3PA Car Charger Reference Design using Southchip ( )

The hardware block diagram is below:

2. EZ-PD™ CCG3PA USB-C PPS 39W Dual Port Car Charger (Power Adapter) Reference Design (

The hardware block diagram is below:

3. EZ-PD™ CCG3PA USB-C Mobile Power Adapter Solution using Power Integrations ( )

The hardware block diagram is below:

4. EZ-PD™ CCG3PA USB-C Mobile Power Adapter Solution using Diodes ( )

The hardware block diagram is below:

5. 45W EZ-PD™ CCG3PA USB-C Notebook Power Adapter Solution using MPS ( )

The hardware block diagram is below:

From all of block diagram, the design is demonstrating each port (either Type-C or Type-C) have dedicated DC/DC convector or AC/DC convector. If you are looking for a single DC/DC convector or AC/DC convector designed to service Type-C and Type-C port. Below block diagram could be refer to. This design could be easy to achieve based on above reference design.


1) VBUS_IN_DIS and VBUS_C_MON can be exchanged.

2) The VBUS enable sequence is supported by dynamically, the priority of Type-C or Type-A shall be defined before firmware customize. (This is trade off the BOM cost down).

3) Need additional Type-A detach/attach circuits for Type-A port. If the detach/attach circuits is composed by Amplifier, the current detect accuracy shall be consideration (50mA as minimum recommend).

4) CCG3PA is looking for Vfb=1.2V.

Take CYPD3125 for example. Here are the steps to change it to CYPD3123:

1.Right click on Project ‘CYPD-3125-40LQXI_notebook01’ [CYPD-3125-40LQXIT] and choose Device Selector…

Change the part number from CYPD3125-40LQXIT to CYPD3123-40LQXIT

2. TopDesign.cysch page, double click on Bootloadable_1 component. Click on Dependencies tab and change the path of Bootloader HEX file. The bootloader file of CYPD3123-40LQXIT can be found in “C:\Program Files (x86)\Cypress\EZ-PD CCGx SDK\CCG3-CCG4\Firmware\projects\CYPD3123-40LQXI_ctd_us\CYPD3123-40LQXI_ctd_us.cydsn\Bootloader”. The Bootloader ELF file path will be changed automatically when Bootloader HEX file path has been modified.

3.Compile the project.


The project still uses the USB bootloader of the CYPD3123. If you want a CYPD3123 project with I2C bootloader, then you’ll need project file for the bootloader of CYPD3125 (which is not included in the current version of SDK). Change the device part number with the same steps above, then use the generated HEX file for bootloader dependency.

Filter Blog

By date:
By tag: