Skip to main content
NApps.1
Associate II
September 17, 2021
Question

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?

  • September 17, 2021
  • 4 replies
  • 5901 views

..

This topic has been closed for replies.

4 replies

TDK
Super User
September 17, 2021

> I am currently using a STM32G081b eval board with a STM32G474QE MCU

Doesn't that board have a STM32G081RBT6 chip?

USB-PD is messy. It needs to request the correct voltages, it might be requesting something else. Perhaps look at differences in what the displays need.

"If you feel a post has answered your question, please click ""Accept as Solution""."
NApps.1
NApps.1Author
Associate II
September 20, 2021

Yes it does have a STM32G081RBT6 chip and the USB-PD side looks correct I have created my own profiles for the voltage which works fine. Using my MacBook pro and hp laptop I can get power, display yet when I try tablets its only provides power I have seen from a STM32 demo video that you can get display out of mobile devices/tablets.

Yohann M.
ST Employee
September 22, 2021

Dear @NA.1067pps​ 

Further information regarding the DP scenario is available in the wiki page.

To understand your issue, you could generate a .cpd trace (Specific tools section).

Regards,

Yohann

NApps.1
NApps.1Author
Associate II
September 22, 2021

This is the log I get when I plug in an ipad just gives me charge no display

NApps.1
NApps.1Author
Associate II
September 27, 2021

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?

Yohann M.
ST Employee
September 27, 2021

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

NApps.1
NApps.1Author
Associate II
September 27, 2021

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
September 27, 2021

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.

NApps.1
NApps.1Author
Associate II
September 27, 2021

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.

Yohann M.
ST Employee
September 28, 2021

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