Does the latest STM USB-PD Core stack support Electronically Marked Cable ?
If it does support EMC, how can I read some ID information from the cable?
If it does support EMC, how can I read some ID information from the cable?
Dear @ADoro.2
I confirm than STM USB-PD core stack supports EMC cable.
Please find the associated Message Sequence Chart:
The option '_VCONN_SUPPORT' should be enabled in your workspace.
With this switch, "DPM_Params[PortNum].VconnStatus" variable is set to USBPD_TRUE and will be used to activate VCONN and start VDM negotiation on EMC cable (VDM Discovery message).
You could refer to demonstration code on STM32G081B-EVAL board to see where this flag is enabled:
This activation is necessary to enable VCONN on the CC line used to power on the cable like this
USBPD_StatusTypeDef USBPD_PWR_IF_VBUSEnable(uint8_t PortNum)
{
/* USER CODE BEGIN USBPD_PWR_IF_VBUSEnable */
USBPD_StatusTypeDef _status = USBPD_ERROR;
/* check for valid port */
if (USBPD_PORT_IsValid(PortNum))
{
POWER_IF_TRACE(PortNum, "EN_VBUS", 7);
/* Set the new state */
#ifdef _TRACE
char str[20];
sprintf(str, "CC:%d VCONN:%d", DPM_Params[PortNum].VconnCCIs, DPM_Params[PortNum].VconnStatus);
POWER_IF_TRACE(PortNum, (uint8_t*)str, strlen(str));
#endif /* _TRACE */
_status = (USBPD_StatusTypeDef)HW_IF_PWR_Enable(PortNum, USBPD_ENABLE, DPM_Params[PortNum].VconnCCIs, DPM_Params[PortNum].VconnStatus, USBPD_PORTPOWERROLE_SRC);
}
return _status;
/* USER CODE END USBPD_PWR_IF_VBUSEnable */
}And
USBPD_StatusTypeDef HW_IF_PWR_Enable(uint8_t PortNum, USBPD_FunctionalState state, CCxPin_TypeDef Cc, uint32_t VconnState, USBPD_PortPowerRole_TypeDef role)
{
UNUSED(role);
int32_t status;
if (USBPD_ENABLE == state)
{
#if defined(_VCONN_SUPPORT)
if (USBPD_TRUE == VconnState)
{
POWER_DEBUG((uint8_t *)"VCONN ON", 8);
(void)BSP_USBPD_PWR_VCONNOn(PortNum, Cc);
}
#endif /* _VCONN_SUPPORT */Cable ID information will be retrieved thanks to the callback in usbpd_vdm_user code:
static void USBPD_VDM_InformIdentity(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, USBPD_VDM_CommandType_Typedef CommandStatus, USBPD_DiscoveryIdentity_TypeDef *pIdentity)
{
/* USER CODE BEGIN USBPD_VDM_InformIdentity */
switch(CommandStatus)
{
case SVDM_RESPONDER_ACK :
if (USBPD_SOPTYPE_SOP1 == SOPType)
{
uint8_t* disco_ident;
disco_ident = (uint8_t*)&DPM_Ports[PortNum].VDM_DiscoCableIdentify;
memcpy(disco_ident, (uint8_t*)pIdentity, sizeof(USBPD_DiscoveryIdentity_TypeDef));
DEMO_SetCableInfo(PortNum, pIdentity);
if (NULL != DPM_GUI_SaveInfo)
{
DPM_GUI_SaveInfo(PortNum, VDM_CABLE_INFO, (uint8_t*)pIdentity, sizeof(USBPD_DiscoveryIdentity_TypeDef));
}
}Regards,
Yohann
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.