[CCGx Power SDK] Based on APP_PPS_SINK_SUPPORT, customize tester for PPS SOURCE
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
WHEN start to design Power Source with APDO, tester shall be taken consideration.
1) Use Third Lab verified tester
- QuadraMAX https://usb.org/estore
2) Use function power negotation tester
- USBCEE www.usbcee.com
- Power-Z https://www.chargerlab.com/category/power-z/
- .... (Others)
3) Make a Tester by CCG3PA CYPD3171 (CY4532)
The mainly steps for make a Tester of USB PD SOURCE and specified to APDO request. (Based on the hardware of CY4532, if the target board is CCG3PA customized board, the project pin assignment shall be clean at first.)
Step 1. New branch/created a project from CCGx Power SDK and select CYPD3171-24LQXQ_pb as example code. And rename to the name you like to, for example, CYPD3171-24LQXQ_pps. You will get a project like below:
Step 2. Open config.h file and find out #define APP_PPS_SINK_SUPPORT (0u) and changed to #define APP_PPS_SINK_SUPPORT (1u).
Step 3. Went through all of APIs offered by CCGx Power SDK and decide to keep or comments out as per requirements.
(1) Below APIs from CCGx Power SDK.
static void snk_recontract_timer_cb (uint8_t port, timer_id_t id);
static void snk_recontract_cb (uint8_t port, resp_status_t resp, const pd_packet_t *pkt_ptr);
static void snk_recontract_timer_cb (uint8_t port, timer_id_t id);
uint8_t hpi_user_reg_handler(uint16_t addr, uint8_t size, uint8_t *data)
void app_pps_sink_disable(uint8_t port);
(2) Based on the API uint8_t hpi_user_reg_handler(uint16_t addr, uint8_t size, uint8_t *data), it is difficult to transform the Voltage and Current clearly. So that, I refer this API and make additional API to initial APDO request directly.
void pps_request_handler(uint8_t port, uint32_t voltage, uint32_t current)
{
int8_t i;
const dpm_status_t *dpm_stat;
dpm_stat = dpm_get_info (TYPEC_PORT_0_IDX);
for(i = receive_src_pdo_count; i >= 0; i--)
{
if(receive_src_pdo[i].fixed_src.supply_type == PDO_AUGMENTED)
{
if((receive_src_pdo[i].pps_src.max_volt * 100 >= voltage) &&
(receive_src_pdo[i].pps_src.min_volt * 100 <= voltage))
{
pps_request.val = 0;
pps_request.rdo_pps.obj_pos = i+1;
pps_request.rdo_pps.out_volt = voltage/20;
if(receive_src_pdo[i].pps_src.max_cur * 50 >= current)
{
pps_request.rdo_pps.op_cur = current/50;
pps_request.rdo_pps.cap_mismatch = false;
}
else
{
pps_request.rdo_pps.op_cur = receive_src_pdo[i].pps_src.max_cur;
pps_request.rdo_pps.cap_mismatch = true;
}
pd_pps_flag = true;
break;
}
}
}
/* Operation is only valid if we are a sink and PD contract exists. */
if ((dpm_stat->contract_exist != 0) && (dpm_stat->cur_port_role == PRT_ROLE_SINK) &&
(dpm_stat->spec_rev_sop_live >= PD_REV3))
{
app_prog_rdo[port] = pps_request;
app_pps_snk_en[port] = true;
first_request =1;
/* Start a timer which will start re-negotiation so that PPS source can be selected. */
timer_start (port, 0x91, 1, snk_recontract_timer_cb);
}
}
Step 4. Re-build the firmware and re-fresh the binaries of CYPD3171.