2021-09-17 04:26 AM
2021-09-23 03:44 AM
Logs should be here for MacOS : ~/Library/STM32CubeMonitor-UCPD/Logs
2021-09-27 08:43 AM
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?
2021-09-27 09:17 AM
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
2021-09-27 09:26 AM
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?
2021-09-27 11:18 AM
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.
2021-09-27 11:51 AM
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.
2021-09-27 11:28 PM
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
2021-09-28 12:22 AM
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?
2021-09-28 02:07 AM
Hi @NA.1067pps
UCPD log can help to understand the issue...
Yohann
2021-09-28 02:20 AM