Hello @RHelv.1
I checked you file and if your application is using DRP state machine you need to apply following fix to avoid a new attachment
line 854 of your files
case USBPD_CAD_STATE_SWITCH_TO_SRC:
case USBPD_CAD_STATE_SWITCH_TO_SNK:
{
/* patch force detach */
if( _handle->ForceSRCDetach == USBPD_TRUE)
{
_timing = CAD_INFINITE;
}
else
{
LL_UCPD_RxDisable(Ports[PortNum].husbpd);
if (USBPD_CAD_STATE_SWITCH_TO_SRC == _handle->cstate)
{
USBPDM1_AssertRp(PortNum);
Ports[PortNum].params->PE_PowerRole = USBPD_PORTPOWERROLE_SRC;
Ports[PortNum].params->PE_DataRole = USBPD_PORTDATAROLE_DFP;
_timing = Ports[PortNum].settings->CAD_SRCToggleTime;
}
if (USBPD_CAD_STATE_SWITCH_TO_SNK == _handle->cstate)
{
USBPDM1_AssertRd(PortNum);
Ports[PortNum].params->PE_PowerRole = USBPD_PORTPOWERROLE_SNK;
Ports[PortNum].params->PE_DataRole = USBPD_PORTDATAROLE_UFP;
_timing = Ports[PortNum].settings->CAD_SNKToggleTime;
}
_handle->CAD_tToggle_start = HAL_GetTick();
_handle->cstate = USBPD_CAD_STATE_DETACHED;
}
}
break;
This patch is not perfect because it doesn't allow switching to SNK case (which could be interesting for a DRP requiring power). But you can easily allow the execution of the sink part in ForceSRCDetach case.
BR
Dominique