cancel
Showing results for 
Search instead for 
Did you mean: 

How to send a Unstructured VDM in stm32g0?

Gbang
Associate III

I found senduvdm callback in usbpd_vdm_user,c "USBPD_VDM_SendUVDM(uint8_t PortNum, USBPD_UVDMHeader_TypeDef *pUVDM_Header, uint8_t *pNbData, uint32_t *pVDO)";

and just found one interface,USBPD_StatusTypeDef USBPD_PE_UVDM_RequestMessage (uint8_t PortNum, USBPD_SOPType_TypeDef SOPType ), which can't set my data,and how to send an uvdm package after call a "send interface" ?

1 ACCEPTED SOLUTION

Accepted Solutions
Yohann M.
ST Employee

Hello

Here is the associated Message Sequence Chart you can refer to:0690X00000AqfEwQAJ.png

To fill data, you have to complete the following callbacks functions in usbpd_vdm_user.c file:

/**
  * @brief  VDM Send Unstructured message callback
  * @param  PortNum    current port number
  * @param  pUVDM_Header  Pointer on UVDM header based on @ref USBPD_UVDMHeader_TypeDef
  * @param  pNbData       Pointer of number of VDO to send
  * @param  pVDO          Pointer of VDO to send
  * @retval None
  */
static void USBPD_VDM_SendUVDM(uint8_t PortNum, USBPD_UVDMHeader_TypeDef *pUVDM_Header, uint8_t *pNbData, uint32_t *pVDO)
{
/* USER CODE BEGIN USBPD_VDM_SendUVDM */
 
/* USER CODE END USBPD_VDM_SendUVDM */
}
 
/**
  * @brief  Unstructured VDM  message callback to inform user of reception of UVDM message
  * @param  PortNum    current port number
  * @param  UVDM_Header UVDM header based on @ref USBPD_UVDMHeader_TypeDef
  * @param  pNbData    Pointer of number of received VDO
  * @param  pVDO       Pointer of received VDO
  * @retval USBPD Status
  */
static USBPD_StatusTypeDef USBPD_VDM_ReceiveUVDM(uint8_t PortNum, USBPD_UVDMHeader_TypeDef UVDM_Header, uint8_t *pNbData, uint32_t *pVDO)
{
/* USER CODE BEGIN USBPD_VDM_ReceiveUVDM */
  return USBPD_ERROR;
/* USER CODE END USBPD_VDM_ReceiveUVDM */
}

View solution in original post

1 REPLY 1
Yohann M.
ST Employee

Hello

Here is the associated Message Sequence Chart you can refer to:0690X00000AqfEwQAJ.png

To fill data, you have to complete the following callbacks functions in usbpd_vdm_user.c file:

/**
  * @brief  VDM Send Unstructured message callback
  * @param  PortNum    current port number
  * @param  pUVDM_Header  Pointer on UVDM header based on @ref USBPD_UVDMHeader_TypeDef
  * @param  pNbData       Pointer of number of VDO to send
  * @param  pVDO          Pointer of VDO to send
  * @retval None
  */
static void USBPD_VDM_SendUVDM(uint8_t PortNum, USBPD_UVDMHeader_TypeDef *pUVDM_Header, uint8_t *pNbData, uint32_t *pVDO)
{
/* USER CODE BEGIN USBPD_VDM_SendUVDM */
 
/* USER CODE END USBPD_VDM_SendUVDM */
}
 
/**
  * @brief  Unstructured VDM  message callback to inform user of reception of UVDM message
  * @param  PortNum    current port number
  * @param  UVDM_Header UVDM header based on @ref USBPD_UVDMHeader_TypeDef
  * @param  pNbData    Pointer of number of received VDO
  * @param  pVDO       Pointer of received VDO
  * @retval USBPD Status
  */
static USBPD_StatusTypeDef USBPD_VDM_ReceiveUVDM(uint8_t PortNum, USBPD_UVDMHeader_TypeDef UVDM_Header, uint8_t *pNbData, uint32_t *pVDO)
{
/* USER CODE BEGIN USBPD_VDM_ReceiveUVDM */
  return USBPD_ERROR;
/* USER CODE END USBPD_VDM_ReceiveUVDM */
}