cancel
Showing results for 
Search instead for 
Did you mean: 

I am currently using a STM32G081b eval board with a STM32G474QE MCU I am using the demoucpd example code if i plug in display for my laptop it works over usb c but doesn't on mobiles device does anyone know why?

NApps.1
Associate II
 
22 REPLIES 22

Logs should be here for MacOS : ~/Library/STM32CubeMonitor-UCPD/Logs

NApps.1
Associate II

I believe I may have found my problem I am trying to run one usb c port to do power and display. Does your library only allow a usb c port to be ether power or display?

I found in your usbpd_def.h some externs do this relate to default values found in the library file if so how can I change this as if I remove the #define __USBPD_DPM_CORE_C it just gives me a load of errors?

No you could configure both port to do power and display... After the limitation is on HW side.

Description of our application is described in USB Power Delivery overview - stm32mcu.

'usbpd_def.h' is the definition file for USB-PD stack library... There are no relations with the Display port configuration which is done in usbpd_vdm_user.c file.

Externs are defined in usbpd_dpm_conf.h file and have a link the user code (usbpd_dpm_core.c) and then __USBPD_DPM_CORE_C is defined in the file.

Yohann

So I am currently have the mind set the device needs to be a DRP to do power and display. Can I just set it up to be a Source ie provide power to say laptop/tablet and also do the display side of things?

Yohann M.
ST Employee

yes it is possible... You can request a data role swap to switch your data role if needed (to be in Source + Device mode).

Please refer to Managing USB power delivery systems with STM32 microcontrollers - User manual §4.4.1.

A DPM function is available: USBPD_DPM_RequestDataRoleSwap.

Where would be the best place to request the Data Role Swap? Would it be in USBPD_DPM_Notification same as power role swap recommended here.

Right it is the same suggestion:

/**
  * @brief  Callback function called by PE to inform DPM about PE event.
  * @param  PortNum The current port number
  * @param  EventVal @ref USBPD_NotifyEventValue_TypeDef
  * @retval None
  */
void USBPD_DPM_Notification(uint8_t PortNum, USBPD_NotifyEventValue_TypeDef EventVal)
{
/* USER CODE BEGIN USBPD_DPM_Notification */
  switch(EventVal)
  {
  case USBPD_NOTIFY_STATE_SRC_READY:
    {
      /* Check that the current data role is not already in UFP (device) */
      if (USBPD_PORTDATAROLE_DFP == DPM_Params[PortNum].PE_DataRole)
      {  
         if (USBPD_DPM_RequestDataRoleSwap(PortNum) != USBPD_OK)
         {
            /* Stack is BUSY... Suggest to postpone the request in using a timer
                 to delay this request... Refer to DPM_TimerSRCExtendedCapa usage in 
                 EVAL Demonstration */
            DPM_START_TIMER(PortNum, DPM_TimerRetryDRS, 100);
      }
    }
    break;
  default :
    break;
  }
/* USER CODE END USBPD_DPM_Notification */
}

Usage timer in DPM can be found HERE...

Yohann

Hi Yohann,

Thanks for that I have just tried it seems to work once I get charge and display on both laptop/display however it only works once if i unplug and plug back in i get charge but no display?

Hi @NA.1067pps​ 

UCPD log can help to understand the issue...

Yohann

Here you go I had it display on tablet unplug plug back in and then get no display. If thats any help