cancel
Showing results for 
Search instead for 
Did you mean: 

USB PD enable display port [STM32N6 - SNK]

Brenden_PLUS
Associate III

* board - STM32N6570-DK

*  using STM Cube 1.19.0

* Example - USBPD_SNK

 

Goal - to enable Display port

 

Problem - is i'm getting stuck with the current example.  It gets stuck at SVDM_deiscovery_identity part.  Which in that packet i should be able to start to tell the host that i have display port capability, but i what is currently set it that the message is unsupported.  How would i go about enabling this.

 

Thoughts - In usbpd_vdm_user.c it seems like it has all the stuff that i need to start sending back these kind of messages but they don't seem to be called anywhere.  

There's a function called

USBPD_VDM_DiscoverSVIDs()

But it doesn't seem to be called.  

 

 

Capture from  a STM32 PD G0 - with STM32CubeMonitor app

PD_Example_results.png

1 ACCEPTED SOLUTION

Accepted Solutions
Brenden_PLUS
Associate III

Currently using a

* STM32G071 nucleo board

 

SUB problem

The larger sub problem was i couldn't figure out how to get the VDM messages to work.

 

Solution

  • use reference example DEMOUCPD with cpu STM32G081 eval board
  • make sure your using USBPDCORE_PD3_FULL 
  • Enable VDMSupport
    • You can do this in the ioc file in the middleware 
    • Or usbpd_dpm_conf.h
  • In usbpd_dpm_userr.c, you need to init USBPD_VDM
USBPD_StatusTypeDef USBPD_DPM_UserInit(void)
{
/* USER CODE BEGIN USBPD_DPM_UserInit */
USBPD_VDM_UserInit(USBPD_PORT_0);
  return USBPD_OK;
/* USER CODE END USBPD_DPM_UserInit */
}​

 

  •  in usbpd_vdm_user.c you need to actually setup the callbacks for this subsystem 
USBPD_StatusTypeDef USBPD_VDM_UserInit(uint8_t PortNum)
{
/* USER CODE BEGIN USBPD_VDM_UserInit */

  USBPD_PE_InitVDM_Callback(PortNum, (USBPD_VDM_Callbacks *)&vdmCallbacks);

    return USBPD_OK;
/* USER CODE END USBPD_VDM_UserInit */
}

 

At this point you'll need to start defining some of these objects and looking at the eval example will help a lot with it.  At this point mixing most of the code in the usbpd_vdm_user.c from the eval project my usb monitor program looks like this.  Which was huge!  You can see the SNK send back a SVDM discovery identity packet!

 

GotThePacketSentBack.png

Documentation that was really helpful

From the software stack guide

VDM_description.png

 

View solution in original post

9 REPLIES 9
Brenden_PLUS
Associate III

In usbpd_dpm_conf.h it seems you can edit the DPM_Settings.

 

So i enabled 

.PE_VDMSupport = USBPD_TRUE,

.PE_RespondsToDiscovSOP = USBPD_TRUE, /*!< Can respond successfully to a Discover Identity */ .PE_AttemptsDiscovSOP = USBPD_TRUE,

 

None of these made any further changes.  

FBL
ST Employee

Hi @Brenden_PLUS 

It seems we are getting strange behavior running the example ! An internal ticket is submitted to dedicated team (221407) for further investigation. 

About USBPD_VDM_DiscoverSVIDs API is called to retrieve SVID supported by device and answer to SVDM Discovery SVID init message sent by port partner

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


Do you have any info on whats weird about it?  I've currently moved to a different task, but figuring out this PD is very important to the project.  Just want to make sure this problems is or is not impeding my progress on my task. 

Hi @Brenden_PLUS 

I assume this line, __HAL_PWR_GET_FLAG(PWR_FLAG_USB33RDY) returns true if PWR_FLAG_USB33RDY is set. So, if the flag is set, the code is stuck in the instruction while(__HAL_PWR_GET_FLAG(PWR_FLAG_USB33RDY));

If the code is waiting for the flag to be set, a simple correction could be

 while(!__HAL_PWR_GET_FLAG(PWR_FLAG_USB33RDY));

Keep me updated, if you have further questions.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


What i'm trying to currently figure out is how to to setup this software so that it supports a SVDM_DISCOVERY_IDENTITY response.  In the image from the first post you can see it replay's with a NOT_SUPPORTED response.

 

So i tried to do set in

* usbpd_dpm_conf.h

.PE_VDMSupport = USBPD_TRUE,

.PE_RespondsToDiscovSOP = USBPD_TRUE,

.PE_AttemptsDiscovSOP = USBPD_TRUE,

 

But they didn't do anything or at least i couldn't figure out what they did.  How do i enable or set the SVDM_DISCOVERY_IDENTITY as a sink pd device?

Hi @Brenden_PLUS 

I suggest you the demo provided for G0 eval board, it supports VDM as sink and source pd device.

FBL_0-1763549633883.png

FBL_0-1763552235786.png

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


Brenden_PLUS
Associate III

Currently using a

* STM32G071 nucleo board

 

SUB problem

The larger sub problem was i couldn't figure out how to get the VDM messages to work.

 

Solution

  • use reference example DEMOUCPD with cpu STM32G081 eval board
  • make sure your using USBPDCORE_PD3_FULL 
  • Enable VDMSupport
    • You can do this in the ioc file in the middleware 
    • Or usbpd_dpm_conf.h
  • In usbpd_dpm_userr.c, you need to init USBPD_VDM
USBPD_StatusTypeDef USBPD_DPM_UserInit(void)
{
/* USER CODE BEGIN USBPD_DPM_UserInit */
USBPD_VDM_UserInit(USBPD_PORT_0);
  return USBPD_OK;
/* USER CODE END USBPD_DPM_UserInit */
}​

 

  •  in usbpd_vdm_user.c you need to actually setup the callbacks for this subsystem 
USBPD_StatusTypeDef USBPD_VDM_UserInit(uint8_t PortNum)
{
/* USER CODE BEGIN USBPD_VDM_UserInit */

  USBPD_PE_InitVDM_Callback(PortNum, (USBPD_VDM_Callbacks *)&vdmCallbacks);

    return USBPD_OK;
/* USER CODE END USBPD_VDM_UserInit */
}

 

At this point you'll need to start defining some of these objects and looking at the eval example will help a lot with it.  At this point mixing most of the code in the usbpd_vdm_user.c from the eval project my usb monitor program looks like this.  Which was huge!  You can see the SNK send back a SVDM discovery identity packet!

 

GotThePacketSentBack.png

Documentation that was really helpful

From the software stack guide

VDM_description.png

 

FBL
ST Employee

Hi @Brenden_PLUS 

Welcome and thank you for your feedback.

I suggest to nominate this thread as frequently asked question !

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.