ZHDA137 April 2026 TPS25751A , TPS26750A
大多数 EC 依靠中断来为许多器件提供服务。大多数 TI PD 控制器都提供有 I2Ct_IRQ(中断)线路,通常当 PD 具有 EC 的信息时该线路会置为低电平有效。举例来说,降级至 5V 固定 PDO 可为中断驱动,在 USB-PD GitHub 上就有这样的示例。下面是有关该示例的 EC/PD 流程的伪代码和基本信息。
while(true){
if (connection_present() )
break
}
// begin example code
// connection of USB-PD capable charger causes
// Plug Insert or Removal
// New Contract as Consumer
// Source Capabilities Message Received
// to assert.
interrupt_events = read_i2c1_irq()
if ( interrupt_events.plug_insert_or_removal ){
// do something
} else if ( .... ){
...
}
// clear the interrupts by writing back the same bits
write_i2c1_clear(interrupt_events)
// setup the autonegotiate sink register to 5V max
reduce_power_5v()
// sets AUTO_NEGOTIATE_SINK.AutoComputeSinkMaxVoltage = 0
// sets AUTO_NEGOTIATE_SINK.AutoNegMaxVoltage = 100
write_4CC("ANeg")