USBC PD multiport TCPM debounce CC lines
Hi,
I'm developing 3-port USB PD hub device with STM32 USBPD library. I have an issue with powering up device with a PD contract over USBC port when it has already plugged sinks on other ports.
Investigation over I2C bus communication show that the issue is caused by CC lines debouncing process, which lasts for 120ms and blocks DPM communication with other ports:

I have discovered that this happens in tcpc_set_power function:
/* Check tCCDebounce */
while (CAD_tVBUSDebounce < CAD_tVBUSDebounce_threshold)
{
CAD_tVBUSDebounce = HAL_GetTick() - CAD_tVBUSDebounce_start;
/* Need to check that line is still connected */
uint32_t cc1 = 0xFF, cc2 = 0xFF;
if (USBPD_BUSY == fusb305_tcpc_get_cc(Port, &cc1, &cc2))
{
/* Line has been disconnected */
return USBPD_FAIL;
}
if (CCNONE == state[Port].CC_Pin)
{
/* Line has been disconnected */
return USBPD_FAIL;
}
} which is called by fusb305_tcpc_set_rx_state function in DPM thread.
There is a 4ms delay inside of fusb305_tcpc_get_cc which would be enough to switch to other port management and respond to capability message, but it looks like that DPM does not run type C state machine for each port in parallel (as a RTOS task) and does this sequentially.
As a result, an attached source gets GoodCRC on capabilities message, but does not get a cap request, executes HardReset and the cycle repeats.
I tried to reduce debounce time from 120ms to 30ms and this helps in case of one attached sink. But this violates USB Type C specification (min CC debounce time is 100ms) and also does not work with two attached sinks, so I would need to reduce debounce time even more.
Q1: Is there a way to run DPM Type C state machine in parallel for several ports?
Q2: Is it possible to stop Type C state machine for SRC ports until SNK port gets stable power?
