Browse Source

1.修改开启gateA的策略。

2.新增GP1来检查A口拉载电流。
3.新增状态机方式来控制gateA和BUCK开启与关闭
master
Jipeng.tang 1 month ago
parent
commit
9cb3ff39e6
  1. 8
      .vscode/settings.json
  2. 20
      PD_CPS8841H_33W/code/app/inc/comm_event.h
  3. 10
      PD_CPS8841H_33W/code/app/inc/config.h
  4. 2
      PD_CPS8841H_33W/code/app/inc/porta_detect.h
  5. 116
      PD_CPS8841H_33W/code/app/src/app_porta.c
  6. 152
      PD_CPS8841H_33W/code/app/src/comm_event.c
  7. 8
      PD_CPS8841H_33W/code/app/src/customized.c
  8. 67
      PD_CPS8841H_33W/code/app/src/main.c
  9. 9
      PD_CPS8841H_33W/code/app/src/porta_detect.c
  10. 2
      PD_CPS8841H_33W/code/component/inc/comp_adc.h
  11. 2
      PD_CPS8841H_33W/code/component/inc/comp_powerout.h
  12. 2
      PD_CPS8841H_33W/code/component/inc/comp_protection.h
  13. 6
      PD_CPS8841H_33W/code/component/src/comp_cable_compensation.c
  14. 47
      PD_CPS8841H_33W/code/component/src/comp_powerout.c
  15. 17
      PD_CPS8841H_33W/code/component/src/comp_protection.c
  16. 31
      PD_CPS8841H_33W/code/platform/protocol/pd_protocol/src/pd_typec_detect_patch.c
  17. 3
      PD_CPS8841H_33W/code/platform/rom_inc/comp/comp_config.h
  18. 2
      PD_CPS8841H_33W/code/prl_portable/src/pd.c
  19. 5
      PD_CPS8841H_33W/project/cps8841H.uvprojx

8
.vscode/settings.json

@ -0,0 +1,8 @@
{
"files.associations": {
"drv_analog.h": "c",
"iterator": "c",
"comp_protocol_manager.h": "c",
"comp_sample_volt_cur_report.h": "c"
}
}

20
PD_CPS8841H_33W/code/app/inc/comm_event.h

@ -0,0 +1,20 @@
#ifndef __COMM_EVENT_H__
#define __COMM_EVENT_H__
typedef enum
{
PORT_IS_NULL = 0,
SINGLE_TYPEC_INSER,
SINGLE_USBA_INSER,
TYPEC_USBA_INSER,
} e_port_status;
typedef enum
{
port_enter_status,
port_exit_status,
} e_port_process_status;
void port_status_run(void);
#endif

10
PD_CPS8841H_33W/code/app/inc/config.h

@ -29,11 +29,15 @@ typedef struct user_app_s
uint16_t interrupt_event_1;
uint16_t interrupt_event_2;
bool buck_state;
uint16_t usba_high_current_vol;
uint16_t test_c_ocp_current;
} user_app_s;
extern user_app_s user_app;
/******************log debug***************************/
#define UART_DEUG 1
#define UART_DEUG 0
#if UART_DEUG
@ -175,7 +179,7 @@ extern user_app_s user_app;
#define RT2_SCAL_EN 0
#endif /**ADC_RT2_SAMPLE_EN*/
#define ADC_RT3_SAMPLE_EN 1
#define ADC_RT3_SAMPLE_EN 0
#if ADC_RT3_SAMPLE_EN
//1:1/2 0:1/1
#define RT3_SCAL_EN 0
@ -187,7 +191,7 @@ extern user_app_s user_app;
#define RT4_SEL_PIN_MUX RT4
#define ADC_RT4_SAMPLE_EN 0
#define ADC_CHIP_TEMP_SAMPLE_EN 0
#define ADC_CHIP_TEMP_SAMPLE_EN 1
#define ADC_VD_SAMPLE_EN 0
#define ADC_LS_CUR_SAMPLE_EN 1
#define ADC_GP1_SAMPLE_EN 1

2
PD_CPS8841H_33W/code/app/inc/porta_detect.h

@ -15,7 +15,7 @@ enum
USBA_PLUGIN_DETECT_LEVEL_NUM,
};
#define USBA_PLUGIN_DEB_TIME 100 /* in unit of ms */
#define USBA_PLUGIN_DEB_TIME 10//100 /* in unit of ms */
#define USBA_PLUGOUT_DEB_TIME 6000//60000 /* in unit of ms */
#define USBA_PLUGOUT_IOUT_LS_THERSH 10 /* in unit of mA */

116
PD_CPS8841H_33W/code/app/src/app_porta.c

@ -7,47 +7,56 @@
#include "pd_send_new_src_cap.h"
#include "pd.h"
#include "comp_pd_manager.h"
#include "comp_protection.h"
static bool porta_is_attached = false;
static bool porta_is_attached_pre = false;
void usba_mos_judgment(void)
{
/*
C口没连接, gateA, BUCK
C口连接了, C口当前电压, < 5.5V, gateA, BUCK
> 5.5V, gateA, BUCK
*/
if(typec_is_attched())
{
if(g_powerout_info.set_vol < VOLTAGE_5P5V)
{
buck_control(false);
dpdm_power_a1_gate_enable(true);
// comp_powerout_prl_set_cur(CURRENT_5A);
}
else
{
buck_control(true);
dpdm_power_a1_gate_enable(false);
// C口电压>5V时, 电流维持原本的值
}
}
else // 单A口
{
buck_control(false);
dpdm_power_a1_gate_enable(true);
comp_powerout_prl_set_cur(CURRENT_3A);
}
}
// 只有A口初始化 和 A口状态确定改变才会执行
// void usba_mos_judgment(void)
// {
// /* C口接入时:
// 1. 初始打开BUCK, 检测到A口有插入(即A口有拉电流), 并且C口set_vol < 5.5V
// 则关闭BUCK, 打开gateA
// */
// if(typec_is_attched())
// {
// if( port_a1_is_attached() && g_powerout_info.set_vol < VOLTAGE_5P5V)
// {
// // 加大电流--->开gateA--->关buck
// comp_powerout_prl_set_cur(CURRENT_4A);
// dpdm_power_a1_gate_enable(true);
// buck_control(false);
// }
// else // 电压 > 5.5V以上, 或者 a口没有负载
// {
// // 不需要重新设置电流, C口升压时必定是走协议更新了需要的电流
// buck_control(true);
// dpdm_power_a1_gate_enable(false);
// }
// }
// else // C口没插负载
// {
// if( !port_a1_is_attached() ) // A口没插入时, 使用buck线路来当A口拉电流检测
// {
// buck_control(true);
// dpdm_power_a1_gate_enable(false);
// }
// else // 单A口
// {
// dpdm_power_a1_gate_enable(true);
// buck_control(false);
// comp_powerout_prl_set_cur(CURRENT_3P3A);
// }
// }
// }
void app_porta_detect_init(void)
{
porta_is_attached = false;
porta_is_attached_pre = false;
usba_plugin_detect_init(USBA_PLUGIN_DETECT_LEVEL_LOW);
usba_mos_judgment();
// usba_mos_judgment();
}
static void app_porta_detect_work(void)
@ -73,7 +82,7 @@ static void app_porta_detect_work(void)
return;
}
usba_mos_judgment();
// usba_mos_judgment();
if(attached)
{
@ -104,7 +113,50 @@ bool port_a1_is_attached(void)
return porta_is_attached || porta_is_attached_pre;
}
// 4ms执行一次
void usba_ocp_detect(void)
{
// 使用 9引脚 GP1来当检测。 只有 A+C同在时才需要这个保护, 单A口时原本的保护代码就可以检测到
/*
100mA = 25mv
500mA = 120
1A = 238
1.5A = 360
1.8A = 430
2A = 477
2.3 = 548
2.5 = 595
3 = 716
3.2 = 765
3.3 = 787
// 100mA ≈ 24mv
*/
// A + C 时 A口走1.5A电流, 加阈值就是1.8A进行OCP
uint16_t usba_adc_sample = COMP_ADC_GET_GP1_VOL();
// uint16_t usba_ocp_vpt = 430;
static uint8_t time_cnt = 0;
// A + C 同在时
if(typec_is_attched()
&& !drv_analog_get_usba_detach_sta()
)
{
if(trigger_check(usba_adc_sample,
430,
0,
&time_cnt,
DELAY_100MS))
{
comp_protection_exception_flag_set(PROT_OCP); // A口过流走的保护可以识别为C口
}
}
}
void app_port_a1_work(void)
{
app_porta_detect_work();
usba_ocp_detect();
}

152
PD_CPS8841H_33W/code/app/src/comm_event.c

@ -0,0 +1,152 @@
#include "comm_event.h"
#include "drv_analog.h"
#include <stdbool.h>
#include <stdint.h>
#include "comp_powerout.h"
#include "comp_protocol_manager.h"
#include "comp_sample_volt_cur_report.h"
// 端口状态机
void port_status_run(void)
{
// typeC 和 A口 状态
uint8_t typec_status = 0, usba_status = 0;
static e_port_status port_status = PORT_IS_NULL;
static e_port_status last_port_status = PORT_IS_NULL;
static e_port_process_status port_process_status = port_enter_status;
uint16_t set_current = CURRENT_5A;
typec_status = typec_is_attched();
usba_status = port_a1_is_attached();
if(typec_status && usba_status)
{
port_status = TYPEC_USBA_INSER;
}
else if(typec_status && !usba_status)
{
port_status = SINGLE_TYPEC_INSER;
}
else if(!typec_status && usba_status)
{
port_status = SINGLE_USBA_INSER;
}
else
{
port_status = PORT_IS_NULL;
}
if(last_port_status != port_status)
{
port_process_status = port_enter_status;
}
switch(port_status)
{
case PORT_IS_NULL:
if(port_process_status == port_enter_status)
{
port_process_status = port_exit_status;
// 什么都没接时, 也是用buck给A口供电来检查A口是否插入
buck_control(true);
dpdm_power_a1_gate_enable(false);
}
else
{
}
break;
case SINGLE_TYPEC_INSER:
if(port_process_status == port_enter_status)
{
port_process_status = port_exit_status;
// 单C口时, 常开buck, 关闭gateA, 等A口有拉电流才反过来
buck_control(true);
dpdm_power_a1_gate_enable(false);
}
else
{
}
break;
case SINGLE_USBA_INSER:
if(port_process_status == port_enter_status)
{
port_process_status = port_exit_status;
// 单A口
dpdm_power_a1_gate_enable(true);
buck_control(false);
}
else
{
}
break;
case TYPEC_USBA_INSER:
if(port_process_status == port_enter_status)
{
port_process_status = port_exit_status;
if(g_powerout_info.set_vol < VOLTAGE_5P5V
&& (get_adp_curr_sample_volt() < VOLTAGE_5P5V))
{
// 加大电流--->开gateA--->关buck
// comp_powerout_prl_set_cur(CURRENT_5A);
comp_set_current(&g_powerout_info, CURRENT_5P5A); // 需要立刻设置
// 是否有可能电流环设置的没那么快, 一打开gateA就被拉挂了? 需要加个延迟等电流环设置完再开A?
// drv_delay_us(500);
// drv_delay_ms(5);
dpdm_power_a1_gate_enable(true);
// drv_delay_ms(2);
buck_control(false);
}
else
{
buck_control(true);
dpdm_power_a1_gate_enable(false);
}
}
else
{
// C口开始升压 且 gateA还开着
if(g_powerout_info.set_vol > VOLTAGE_5P5V
&& REG_ANALOG_GATEA->bf.en)
{
// todo: 看看是否需要延迟个1ms等待buck完全开启再关gateA
buck_control(true);
dpdm_power_a1_gate_enable(false);
}
else if(g_powerout_info.set_vol < VOLTAGE_5P5V
&& (get_adp_curr_sample_volt() < VOLTAGE_5P5V)
&& !REG_ANALOG_GATEA->bf.en)
{
// set_current = CURRENT_5A + user_app.usba_high_current_vol;
// if(set_current > CURRENT_6A)
// {
// set_current = CURRENT_6A;
// }
// comp_powerout_prl_set_cur(set_current);
comp_set_current(&g_powerout_info, CURRENT_5P5A); // 需要立刻设置
dpdm_power_a1_gate_enable(true);
buck_control(false);
}
}
break;
}
last_port_status = port_status;
}

8
PD_CPS8841H_33W/code/app/src/customized.c

@ -1223,11 +1223,3 @@ pwr_request_s tfcp_power_request(void)
#endif

67
PD_CPS8841H_33W/code/app/src/main.c

@ -26,6 +26,8 @@
#include "ntc.h"
#include "comp_protocol_manager.h"
#include "comp_powerout.h"
#include "customized.h"
#include "comm_event.h"
user_app_s user_app;
@ -54,33 +56,32 @@ void log_output(void)
// log_info("RT2_CUR:0x%x\n", REG_ANALOG_PUCUR->bf.io2);
log_info("gp1:%d detached_from_hw:%d\n",
log_info("a_cur:%d detached_from_hw:%d\n",
COMP_ADC_GET_GP1_VOL(),
drv_analog_get_usba_detach_sta());
log_info("a_cur:%d rt3:%d\n",
COMP_ADC_GET_LS_CUR(),
COMP_ADC_GET_RT3_VOL());
// log_info("a_cur:%d GP1:%d\n",
// COMP_ADC_GET_LS_CUR(),
// COMP_ADC_GET_GP1_VOL());
// log_info("chip_temp:%d\n", COMP_ADC_GET_CHIP_TEMP_FILTER());
log_info("c_ocp_set:%d c_cur:%d\n",
user_app.test_c_ocp_current,
COMP_ADC_GET_CUR());
}
void comm_event(void)
// A口高端检流
void usba_high_current(void)
{
// if(user_app.interrupt_event_1)
// {
// user_app.interrupt_event_1 = false;
// buck_control(true);
// dpdm_power_a1_gate_enable(false);
// }
// if(user_app.interrupt_event_2)
// {
// user_app.interrupt_event_2 = false;
// dpdm_power_a1_gate_enable(true);
// buck_control(false);
// }
// 24 是实测值, 100mA = 24mv
user_app.usba_high_current_vol = (COMP_ADC_GET_GP1_VOL() * 100 / 24);
}
uint16_t set_current = CURRENT_4A;
void comm_event(void)
{
// uint16_t set_current = CURRENT_4A;
usba_high_current();
#if POWEROUT_SUPPORT
@ -91,21 +92,21 @@ void comm_event(void)
#endif
// A + C 且 电压 <5.5V时 电流要固定为4A
if(typec_is_attched()
&& !drv_analog_get_usba_detach_sta()
&& g_powerout_info.set_vol <= VOLTAGE_5P5V
)
{
set_current = CURRENT_4A + COMP_ADC_GET_LS_CUR();
if(set_current > CURRENT_6A)
{
set_current = CURRENT_6A;
}
port_status_run();
comp_powerout_prl_set_cur(set_current);
}
// // A + C 且 电压 <5.5V时 电流要固定为4A
// if(typec_is_attched()
// && !drv_analog_get_usba_detach_sta()
// && g_powerout_info.set_vol <= VOLTAGE_5P5V
// )
// {
// set_current = CURRENT_4A + user_app.usba_high_current_vol;
// if(set_current > CURRENT_6A)
// {
// set_current = CURRENT_6A;
// }
// comp_powerout_prl_set_cur(set_current);
// }
}
static const periodic_work_entry_s app_works[] =

9
PD_CPS8841H_33W/code/app/src/porta_detect.c

@ -95,12 +95,12 @@ bool usba_plugin_detect(void)
// vbus_voltage = COMP_ADC_GET_RT2_VOL();
// dp_voltage = COMP_ADC_GET_RT4_VOL();
gp1_voltage = 0; //COMP_ADC_GET_GP1_VOL();
gp1_voltage = COMP_ADC_GET_GP1_VOL();
detached_from_hw = drv_analog_get_usba_detach_sta();
// attached = vbus_voltage < vbus_thresh[det_data->level] ||
// dp_voltage < dpdm_thresh[det_data->level];
attached = (gp1_voltage > VOLTAGE_0P1V) ||
attached = (gp1_voltage > VOLTAGE_0P025V) ||
(!detached_from_hw);
if(is_check_vbus)
@ -170,9 +170,8 @@ bool usba_plugout_detect(void)
bool detached_from_hw = drv_analog_get_usba_detach_sta();
uint16_t iout = COMP_ADC_GET_GP1_VOL();
// if(!detached_from_hw || (iout >= 15))
// if(!detached_from_hw || iout >= CURRENT_0P1A) // 电流只要 > 0.1A, 都认为是没拔出
if(!detached_from_hw)
if(!detached_from_hw || iout >= VOLTAGE_0P025V) // 电流只要 > 0.1A, 都认为是没拔出
// if(!detached_from_hw)
{
det_data->last_time = get_sys_time();
return !det_data->attached;

2
PD_CPS8841H_33W/code/component/inc/comp_adc.h

@ -203,7 +203,7 @@ uint16_t comp_adc_vol_channel_coeff(uint16_t adc_code, uint16_t ch_divide, uint1
#define COMP_ADC_GET_CHIP_TEMP_FILTER()\
VOL_CHANNEL_COEFF(g_adc_value_st.real_value[ADC_CHIP_TEMP], 1, 10)
VOL_CHANNEL_COEFF(g_adc_value_st.value[ADC_CHIP_TEMP], 1, 10)
#define COMP_ADC_GET_VD_VOL()\

2
PD_CPS8841H_33W/code/component/inc/comp_powerout.h

@ -375,7 +375,7 @@ void comp_powerout_check_cc_mode(comp_powerout_info_s *powerout_info);
void comp_powerout_prl_set_volt(uint16_t vout);
void comp_powerout_prl_set_cur(uint16_t cur);
void comp_powerout_prl_set_viout(uint16_t vout, uint16_t iout);
// void comp_set_current(comp_powerout_info_s *powerout_info, uint16_t current);
void comp_set_current(comp_powerout_info_s *powerout_info, uint16_t current);
#endif

2
PD_CPS8841H_33W/code/component/inc/comp_protection.h

@ -177,5 +177,7 @@ void comp_protection_monitor(protection_param_s *protection_param);
*/
void comp_protection_run(void);
uint8_t trigger_check(uint16_t curr_value, uint16_t trigger_thrsh, uint8_t less_trigger, uint8_t *times, uint8_t debounce);
#endif

6
PD_CPS8841H_33W/code/component/src/comp_cable_compensation.c

@ -43,6 +43,12 @@ void comp_pwr_vol_cable_comp_task(void)
cable_val = CABLE_COMP_MAX_VOL;
}
// 客户要求只有5V才有线补
if(g_powerout_info.set_vol > VOLTAGE_5P5V)
{
cable_val = 0;
}
cable_comp_change = true;
comp_dac_output_volt_set((get_adp_curr_set_volt() + cable_val));

47
PD_CPS8841H_33W/code/component/src/comp_powerout.c

@ -78,12 +78,12 @@ static void comp_powerout_default_set(comp_powerout_info_s *powerout_info)
comp_powerout_cur_set(powerout_info, powerout_info->set_current);
}
// void comp_set_current(comp_powerout_info_s *powerout_info, uint16_t current)
// {
// powerout_info->set_current = current;
// powerout_info->prl_update_cur = current;
// comp_powerout_cur_set(powerout_info, powerout_info->set_current);
// }
void comp_set_current(comp_powerout_info_s *powerout_info, uint16_t current)
{
powerout_info->set_current = current;
powerout_info->prl_update_cur = current;
comp_powerout_cur_set(powerout_info, powerout_info->set_current);
}
/*
* @brief powerout init
@ -235,7 +235,6 @@ void comp_powerout_transmit_machine(comp_powerout_info_s *powerout_info)
buck_control(true);
drv_delay_ms(1);
dpdm_power_a1_gate_enable(false);
// user_app.interrupt_event_1 = true;
}
}
@ -284,16 +283,18 @@ void comp_powerout_ready_check_machine(comp_powerout_info_s *powerout_info)
#if BUCK_FOLLOW_TYPEC_VOLTAGE
// A+C时, 如果C口电压降回5V,那就先打开GATEA, 然后关闭BUCK。
if(typec_is_attched())
{
if(powerout_info->set_vol < VOLTAGE_5P5V)
{
dpdm_power_a1_gate_enable(true);
buck_control(false);
// user_app.interrupt_event_2 = true;
}
}
// 在port口状态机那边做
// // A+C时, 如果C口电压降回5V,那就先打开GATEA, 然后关闭BUCK。
// if(typec_is_attched())
// {
// if(powerout_info->set_vol < VOLTAGE_5P5V)
// {
// dpdm_power_a1_gate_enable(true);
// buck_control(false);
// // user_app.interrupt_event_2 = true;
// }
// }
#endif
}
@ -333,11 +334,13 @@ void comp_powerout_ready_machine(comp_powerout_info_s *powerout_info)
pwr_request.request_vol = powerout_info->prl_update_vol;
pwr_request.request_cur = powerout_info->prl_update_cur;
// if(pwr_request.request_vol == VOLTAGE_5V)
// {
// pwr_request.request_vol = VOLTAGE_5P2V;
// }
// 如果 A + C 同在, 并且 C口电压 < 5.5V, 则电流limit设置为5A
if(typec_is_attched()
&& port_a1_is_attached()
&& pwr_request.request_vol < VOLTAGE_5P5V)
{
pwr_request.request_cur = CURRENT_5P5A;
}
if((powerout_info->last_vol != pwr_request.request_vol) ||
(powerout_info->last_current != pwr_request.request_cur) ||

17
PD_CPS8841H_33W/code/component/src/comp_protection.c

@ -121,7 +121,7 @@ void comp_protection_init(void)
#if !UART_DEUG
g_protection_param.protection_enable |= VIN_UVP_ENABLE | VIN_OCP_ENABLE;// | DPDN_WET_ENABLE; //| PORT_OTP_ENABLE;
#else
g_protection_param.protection_enable |= VIN_UVP_ENABLE;// | DPDN_WET_ENABLE;
g_protection_param.protection_enable |= VIN_UVP_ENABLE | VIN_OCP_ENABLE;// | DPDN_WET_ENABLE;
#endif
}
@ -151,7 +151,7 @@ void comp_protection_init(void)
* @param debounce
* @return uint8_t
*/
static uint8_t trigger_check(uint16_t curr_value, uint16_t trigger_thrsh, uint8_t less_trigger, uint8_t *times, uint8_t debounce)
uint8_t trigger_check(uint16_t curr_value, uint16_t trigger_thrsh, uint8_t less_trigger, uint8_t *times, uint8_t debounce)
{
if(less_trigger)
{
@ -249,17 +249,8 @@ void comp_protection_monitor(protection_param_s *protection_param)
adc_sample[PROT_OCP] = 0;
}
// 因为只有5V, 所以OCP点电流一定是 3.3A, 再加上A扣的电流
// if(COMP_ADC_GET_LS_CUR() < CURRENT_1A)
// {
// usba_current = COMP_ADC_GET_LS_CUR() + 300;
// }
// else
// {
// usba_current = COMP_ADC_GET_LS_CUR();
// }
// pro_vpt[PROT_OCP] = CURRENT_3P3A + usba_current;
pro_vpt[PROT_OCP] = CURRENT_3P3A + COMP_ADC_GET_LS_CUR();
pro_vpt[PROT_OCP] = CURRENT_3P3A + user_app.usba_high_current_vol;
user_app.test_c_ocp_current = pro_vpt[PROT_OCP];
if(protection_param->otp_derate)
{

31
PD_CPS8841H_33W/code/platform/protocol/pd_protocol/src/pd_typec_detect_patch.c

@ -104,31 +104,12 @@ void pd_typec_time(pd_port_s *pd_port)
*/
static void pd_update_typec_connect_sta(pd_port_s *pd_port)
{
// static bool test_1 = true;
pd_param_s *pd_param = &pd_port->pd_prl_param;
// if(test_1)
// {
// test_1 = false;
// log_info("typec_status:%d typec_process_status:%d\n",
// pd_param->typec_status.typec_status,
// pd_param->typec_status.typec_process_status);
// }
if((pd_param->typec_status.typec_process_status == typec_enter_status) &&
(pd_param->typec_status.typec_status == UnattachedSRC))
{
typec_reset(pd_port);
// typeC未连接时, 关闭BUCK, 打开gateA输出5V。
buck_control(false);
dpdm_power_a1_gate_enable(true);
// C口
// drv_gpio_write(GPIO_PIN3, false);
// drv_gpio_disable_out(GPIO_PIN3);
// drv_gpio_write(GPIO_PIN0, false); // vd mos
dpdm_reset();
log_info("%s %d\n", __func__, __LINE__);
}
@ -137,18 +118,6 @@ static void pd_update_typec_connect_sta(pd_port_s *pd_port)
(pd_param->typec_status.typec_status == AttachedSRC))
{
pd_port->pd_typec_sta = true;
#if !BUCK_FOLLOW_TYPEC_VOLTAGE
// 客户要求 C口输出5V时, A口共用C口电路, 不开启BUCK
buck_control(true);
dpdm_power_a1_gate_enable(false);
#endif
// VD高电平, 分压后当苹果2.4A功能 FB当MOS开关
// drv_gpio_write(GPIO_PIN3, true);
// drv_gpio_enable_out(GPIO_PIN3);
// drv_gpio_write(GPIO_PIN0, true);
dpdm_reset();
// 当C口有插入时, 短接A口的DPDN

3
PD_CPS8841H_33W/code/platform/rom_inc/comp/comp_config.h

@ -62,6 +62,7 @@
#define VOLTAGE_DUAL_PORT_DEFAULT VOLTAGE_5V
#define CURRENT_DUAL_PORT_DEFAULT CURRENT_6A
#define VOLTAGE_0P025V 25
#define VOLTAGE_0P1V 100
#define VOLTAGE_0P2V 200
#define VOLTAGE_0P3V 300
@ -117,6 +118,7 @@
#define CURRENT_0P3A 300
#define CURRENT_0P35A 350
#define CURRENT_0P4A 400
#define CURRENT_0P45A 450
#define CURRENT_0P5A 500
#define CURRENT_0P6A 600
#define CURRENT_0P7A 700
@ -168,6 +170,7 @@
#define CURRENT_4P6A 4600
#define CURRENT_5A 5000
#define CURRENT_5P2A 5200
#define CURRENT_5P5A 5500
#define CURRENT_6A 6000
#define CURRENT_6P2A 6200
#define CURRENT_6P3A 6300

2
PD_CPS8841H_33W/code/prl_portable/src/pd.c

@ -118,7 +118,7 @@ bool app_src_power_handler_patch(pd_param_s *pd_param)
{
if(request_vol == VOLTAGE_20V)
{
offest = CURRENT_0P35A;
offest = CURRENT_0P45A;
}
else
{

5
PD_CPS8841H_33W/project/cps8841H.uvprojx

@ -464,6 +464,11 @@
<FileType>1</FileType>
<FilePath>..\code\app\src\ntc.c</FilePath>
</File>
<File>
<FileName>comm_event.c</FileName>
<FileType>1</FileType>
<FilePath>..\code\app\src\comm_event.c</FilePath>
</File>
</Files>
</Group>
<Group>

Loading…
Cancel
Save