cancel
Showing results for 
Search instead for 
Did you mean: 

USBPD keeps getting state detached after attached_wait

Peterson
Associate

Hi,

I am working on a custom USB-PD board and trying to make a sink. To check if everything was working as is it supposed to do, I followed the "10-minute" sink example from ST.

But when I connect a USB source, the sink keeps detaching the connection in the debounce fase. Does anyone know why this keeps happening?

The MCU used in the project is the STM32G071CBTx and followed the sink sample from ST: https://youtu.be/-vsJhNIaHxE.

G0 FW version: 1.4.0

STM32CubeMX version: 6.1.0

Trace:

0 DEBUG 34043 0 ADVICE: Update BSP_USBPD_PWR_VBUSInit

1 CAD 34043 0 USBPD_CAD_STATE_ATTACHED_WAIT

2 DEBUG 34264 0 ADVICE: Update BSP_USBPD_PWR_VBUSDeInit

3 CAD 34264 0 USBPD_CAD_STATE_DETACHED

4 DEBUG 34778 0 ADVICE: Update BSP_USBPD_PWR_VBUSInit

5 CAD 34778 0 USBPD_CAD_STATE_ATTACHED_WAIT

6 DEBUG 34999 0 ADVICE: Update BSP_USBPD_PWR_VBUSDeInit

7 CAD 34999 0 USBPD_CAD_STATE_DETACHED

8 DEBUG 35513 0 ADVICE: Update BSP_USBPD_PWR_VBUSInit

9 CAD 35513 0 USBPD_CAD_STATE_ATTACHED_WAIT

10 DEBUG 35734 0 ADVICE: Update BSP_USBPD_PWR_VBUSDeInit

11 CAD 35734 0 USBPD_CAD_STATE_DETACHED

1 ACCEPTED SOLUTION

Accepted Solutions
Yohann M.
ST Employee

Dear @Peterson​ 

In USBPD_CAD_STATE_ATTACHED_WAIT state, CAD module is waiting for a stable VBUS voltage higher than USBPD_PWR_HIGH_VBUS_THRESHOLD (2800mV).

Could you please at first check you measure correctly the VBUS voltage in the function 'BSP_USBPD_PWR_VBUSGetVoltage'?

You may display the VBUS voltage into your log in using the tip described in ST Wiki page.

char _str[10];
uint32_t voltage;
BSP_USBPD_PWR_VBUSGetVoltage(0, &voltage);
sprintf(_str,"VBUS:%d", voltage);
USBPD_TRACE_Add(USBPD_TRACE_DEBUG, 0, 0, (uint8_t*)_str, strlen(_str));

Regards,

Yohann

View solution in original post

2 REPLIES 2
Yohann M.
ST Employee

Dear @Peterson​ 

In USBPD_CAD_STATE_ATTACHED_WAIT state, CAD module is waiting for a stable VBUS voltage higher than USBPD_PWR_HIGH_VBUS_THRESHOLD (2800mV).

Could you please at first check you measure correctly the VBUS voltage in the function 'BSP_USBPD_PWR_VBUSGetVoltage'?

You may display the VBUS voltage into your log in using the tip described in ST Wiki page.

char _str[10];
uint32_t voltage;
BSP_USBPD_PWR_VBUSGetVoltage(0, &voltage);
sprintf(_str,"VBUS:%d", voltage);
USBPD_TRACE_Add(USBPD_TRACE_DEBUG, 0, 0, (uint8_t*)_str, strlen(_str));

Regards,

Yohann

Hello Yohann,

The VBUS voltage didn't get higher than 0,5V. After some investigating, I found out a capacitor shorted the VBUS to ground. Now the issue is solved, I can indeed get a 5V contract.

I thought the VBus voltage was enabled when the state changed to ATTACHED. But you are right, debounce and waiting for VBUS is done in the same state. Thank you for your answer!0693W000006HTuQQAW.png