cancel
Showing results for 
Search instead for 
Did you mean: 

There is a problem that USBPD_CAD_Task stops

forst
Associate III
 
Hello,

I am developing a USB Type C charger
The development environment is as follows
 
Hardware
NUCLEO-G071RB (tested on rev C)
X-NUCLEO-DRP1M1 shield
 
Software
x-cube-tcpp
DRP1M1_DRP
 
When this board is connected to a Windows tablet, the CAD task(USBPD_CAD_Task) stops working.
UCPD monitor updates will also stop
 
When connected to an Android tablet, the CAD task does not stop working.
UCPD monitors will not stop updating
 
I also attach a screenshot.
 
Below is the log when the USB cable is plugged in. 
 
Best Regards
-----------------------------------------------------------------
DEBUG312660-- BSP_USBPD_PWR_SetRole : SRC --454
DEBUG313100-- BSP_USBPD_PWR_SetRole : SNK --455
DEBUG313500-- BSP_USBPD_PWR_SetRole : SRC --456
DEBUG313940-- BSP_USBPD_PWR_SetRole : SNK --457
DEBUG314340-- BSP_USBPD_PWR_SetRole : SRC --458
DEBUG314780-- BSP_USBPD_PWR_SetRole : SNK --459
DEBUG314810-- BSP_USBPD_PWR_VBUSInit --460
DEBUG314810-- BSP_USBPD_PWR_SetPowerMode --461
DEBUG314810-- Normal --462
CAD314810USBPD_CAD_STATE_ATTACHED_WAIT463
CAD316030USBPD_CAD_STATE_ATTACHED464
NOTIF316030USBSTACK_START465
EVENT316030EVENT_ATTACHED466
PE316030PE_SNK_STARTUP467
PE316030PE_SNK_WAIT_FOR_CAPABILITIES468
IN317110SOP PD3s:018    H:0x41A1    (id:0, DR:DFP, PR:SRC) SRC_CAPABILITIESDATA: 2C91110A2CD112002CB11400E1401600
Option: DRDEPW
 [1] Fixed : 5V - 3A
 [2] Fixed : 9V - 3A
 [3] Fixed : 15V - 3A
 [4] Fixed : 20V - 2.25A
469
OUT317110SOPs:002    H:0x0041     (id:0, DR:UFP, PR:SNK) GOODCRC470
PE317110PE_SNK_EVALUATE_CAPABILITY471
PE317130PE_SNK_SEND_REQUEST472
OUT 31713 0 SOP PD3 REQUEST s:006     H:0x1082    (id:0, DR:UFP, PR:SNK)  DATA: 96580211
ObjectPosition:1
GiveBack:0
CapabilityMismatch:0
USBCommunicationCapable:0
NoUSBSuspend:1
UnchunkedExtendedMessagesSupported:0473
IN317140SOPs:002    H:0x01A1     (id:0, DR:DFP, PR:SRC) GOODCRC474
PE317140PE_SNK_SELECT_CAPABILITY475
IN317180SOP PD3ACCEPTs:002    H:0x03A3     (id:1, DR:DFP, PR:SRC) 476
OUT317180SOPs:002    H:0x0241     (id:1, DR:UFP, PR:SNK) GOODCRC477
NOTIF317180POWER_STATE_CHANGE478
NOTIF317180REQUEST_ACCEPTED479
PE317180PE_SNK_TRANSITION_SNK480
IN318280SOP PD3PS_RDYs:002    H:0x05A6     (id:2, DR:DFP, PR:SRC) 481
OUT318280SOPs:002    H:0x0441     (id:2, DR:UFP, PR:SNK) GOODCRC482
NOTIF318280POWER_STATE_CHANGE483
NOTIF318290POWER_EXPLICIT_CONTRACT484
PE318290PE_STATE_READY485
NOTIF318290STATE_SNK_READY486
PE318290PE_STATE_READY_WAIT487
IN318900SOPs:006 PD3    H:0x17AF    (id:3, DR:DFP, PR:SRC) VENDOR_DEFINED
VDM:SVDM_DISCOVER_SVIDS INIT DATA:02A000FF
488
OUT318900SOPs:002    H:0x0641     (id:3, DR:UFP, PR:SNK) GOODCRC489
PE318900PE_SEND_NOTSUPPORTED490
OUT318920SOP PD3NOT_SUPPORTEDs:002    H:0x0290     (id:1, DR:UFP, PR:SNK) 491
IN318930SOPs:002    H:0x03A1     (id:1, DR:DFP, PR:SRC) GOODCRC492
PE318930PE_STATE_READY493
NOTIF318950STATE_SNK_READY494
PE318950PE_STATE_READY_WAIT495

 

1 ACCEPTED SOLUTION

Accepted Solutions
Nicolas P.
ST Employee

Hello @forst 

Yes, depending on what you plug the devices will not behave the same.

On the trace you've shared, we see that it is from the sink. And after an explicit contract, we see that we get some SVDM_DISCOVER_SVIDS message from the source. The sink replies "NOT_SUPPORTED", which is a behavior you can change in the user application.

Sometime, when a device receives this "not supported" message, it asks again forever, because it could be that the answer changes over time.This is application choice. So this can explain why you see differences between Android and Windows. Even depending on the devices brand, the dialogs are different, depending on the feature they support (USB capability, VDM options...)

I don't see Android or Windows trace here. Could you give the related traces ?

Why do you say that CAD stops working ? CAD is the CAble Detection part. If you don't unplug or plug the cable, CAD states should not change. The states of CAD (USBPD_CAD_STATE_ATTACHED_WAIT, USBPD_CAD_STATE_ATTACHED...) are described in the file  usbpd_cad_hw_if.c. Have a loot also at this part of the wiki.

The picture you shared seems the same as the trace text. It would be easier to share the full .cpd trace, it is much practical to read back using STM32CubeMonitor-UCPD.

View solution in original post

4 REPLIES 4
Nicolas P.
ST Employee

Hello @forst 

Yes, depending on what you plug the devices will not behave the same.

On the trace you've shared, we see that it is from the sink. And after an explicit contract, we see that we get some SVDM_DISCOVER_SVIDS message from the source. The sink replies "NOT_SUPPORTED", which is a behavior you can change in the user application.

Sometime, when a device receives this "not supported" message, it asks again forever, because it could be that the answer changes over time.This is application choice. So this can explain why you see differences between Android and Windows. Even depending on the devices brand, the dialogs are different, depending on the feature they support (USB capability, VDM options...)

I don't see Android or Windows trace here. Could you give the related traces ?

Why do you say that CAD stops working ? CAD is the CAble Detection part. If you don't unplug or plug the cable, CAD states should not change. The states of CAD (USBPD_CAD_STATE_ATTACHED_WAIT, USBPD_CAD_STATE_ATTACHED...) are described in the file  usbpd_cad_hw_if.c. Have a loot also at this part of the wiki.

The picture you shared seems the same as the trace text. It would be easier to share the full .cpd trace, it is much practical to read back using STM32CubeMonitor-UCPD.

forst
Associate III

Hello,

I disabled the support in some PD settings to try

・Fast Role Swap
・Ping Support
・Fast Role Swap Support
・Src CapExt Support
・FirmUpdateRequest Support
・Unchunk Support

Then CAD no longer stopped working.

Is there a PD setting that is not supported by x-cube-tcpp?

Nicolas P.
ST Employee

@forst the x-cube-tcpp give a few examples of simple applications. But there are a lot of options in the power delivery specification. So all of them cannot be demonstrated with one application.

ST provides the stack as a toolbox. But every client need to put in place their own needs. This is why we have inserted some help in the trace.

For example in the file usbpd_dpm_user.c you will see lines like :

 

 

DPM_USER_DEBUG_TRACE(PortNum, "ADVICE: update USBPD_DPM_SetDataInfo:%d", DataId);

 

 

If you get such "ADVICE" messages in your trace (using STM32CubeMonitor-UCPD), it means that you have to add some application part.

You can get inspiration from the G0 evaluation demo code here.

Can you give details on what you mean by "CAD stop working" ? Can you share such a .cpd trace ?

 

Hello,

I am currently unable to reproduce the issue of CAD not working.

Here is a screenshot of what appears to be when the problem occurred at the time.

From the attached file,

I remember that the CAD task was not working properly due to a series of IRQ interrupts for some unknown reason.