This is mini customize firmware based on Notebook firmware example for power bank solution. This is Dual Role Port design with software disable and delete DisplayPort, HPI, and I2C master from the project. (Since HPI have pre-build as a library, the HPI cannot disable it totally).

 

The firmware modification process is almost as below.

  1. Firmware compiler setting before re-build firmware project.

     a. Install MDK.exe from link:

     http://www2.keil.com/mdk5

     b. Open CYPD2122-24LQXI project and select Tools>Options>Project Management>ARM Toolchains

     c. Fill ARMCC.exe folder path in ARM MDK Generic (default): (Refer below Figure).

 

Creator.png

2. Customize source code of Notebook example on Creator

  1. Open/New Create a Notebook project with code example.
  2. Double click TopDesign.cysch and disable HPD, HPI, I2C related components.

sch.png

And then save all.

     c. Open usbpd_config.h under notebook project Header Files and change below configuration define.

    • #define DISPLAY_PORT_SRC_CONFIGURATION

     Open usbpd.h under notebook project Header Files and change below configuration define.

    • #define HPI_CONFIGURATION

 

     d. Open file dp_source.c to add below function in it.

void dp_source_init(void)

{

 

}

 

void dp_source_deinit(void)

{

 

}

 

tDP_STATE get_dp_state (void)

{

    return 0;

}

 

bool update_dp_config(uint8_t config_cmd)

{

    return 1;

}

 

 

     e. Set Project”Notebook” as Active, and then rebuild the project. You shall get 26 Errors or more errors as below. And check all errors related MUX (CY4521 hardware have PS874x on board) to clean errors from I2C Master.

error.png

     f. Save all changes and re-build project.

 

-----------------------------------------a clean project can be used for CCG2 DRP (or power bank) design----------------------------------------------