cancel
Showing results for 
Search instead for 
Did you mean: 

BSP_PWR_VBUSGetVoltage Obsolete?

sir_urx
Associate

Hi,

I am starting to implement USB PD Sink application and i run into issue.

I followed the AN5418.

Seems the BSP_PWR_VBUSGetVoltage is Obsolete and i did not find any info how to implement it in alternative way. Found some posts that hint this might be an issue that it does not return the value.

Any advise what to check would be helpful.

 

__weak uint32_t BSP_PWR_VBUSGetVoltage(uint32_t PortId)

{

PWR_DEBUG_TRACE(PortId, "ADVICE: Obsolete BSP_PWR_VBUSGetVoltage");

/* USER CODE BEGIN BSP_PWR_VBUSGetVoltage */

uint32_t voltage = 0;

(void)BSP_USBPD_PWR_VBUSGetVoltage(PortId, &voltage);

return voltage;

/* USER CODE END BSP_PWR_VBUSGetVoltage */

}

 

In trace i get:

18 CAD 5 1 USBPD_CAD_STATE_DETACHED
19 DEBUG 49 1 ADVICE: Update BSP_USBPD_PWR_VBUSInit
20 CAD 49 1 USBPD_CAD_STATE_ATTACHED_WAIT
21 CAD 168 1 USBPD_CAD_STATE_ATTACHED
22 NOTIF 168 1 USBSTACK_START
23 DEBUG 168 1 ADVICE: USBPD_DPM_Notification:104
24 EVENT 168 1 EVENT_ATTACHED
25 DEBUG 168 1 ADVICE: update USBPD_DPM_UserCableDetection
26 DEBUG 168 1 ADVICE: USBPD_DPM_Notification:104
27 DEBUG 168 1 ADVICE: update USBPD_DPM_SetDataInfo:2
28 DEBUG 168 1 ADVICE: update USBPD_DPM_SetDataInfo:6
29 PE 168 1 PE_SNK_STARTUP
30 PE 168 1 PE_SNK_WAIT_FOR_CAPABILITIES

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

I found out that i chased the "ghosts".

The issue why i got strange messages was that project was set up incorrectly.

There are many different instructions out there and i needed to take one which includes adding board package.

https://www.youtube.com/watch?v=cbdFHmMOMwk&t=779s

This solved all my issues.

Thank you for explanation, this is also good thing to know as i move forward with a project.

Just a background info: i started without a kit, custom board, which did not had enough memory to include GUI and debug info on build. So i tried to use minimal components. After buying SNK1M1 kit + MCU board i found the correct video through references to the boards. It's way easier to strip out unwanted parts of code than guess what is missing :)

View solution in original post

2 REPLIES 2
FBL
ST Employee

Hi @sir_urx 

BSP_USBPD_PWR_VBUSGetVoltage is being used within BSP_PWR_VBUSGetVoltage. Maybe for that reason it's considered as obsolete.

You can put a breakpoint, run the code and check if BSP_USBPD_PWR_VBUSGetVoltage is being called correctly and if it returns a valid voltage value. Then, it should be called with the right coefficient depending on the VBUS divider bridge you are implementing.

Check section 5.6.3 Modification in usbpd_pwr_user.c in same app note.

On the X-NUCLEO-USBPDM1 shield, Value is multiplied by 5.97 (Divider R6/R7 40.2 kΩ/200 kΩ) for VSENSE.
Check the Wiki, it should helpful.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.


Hi,

I found out that i chased the "ghosts".

The issue why i got strange messages was that project was set up incorrectly.

There are many different instructions out there and i needed to take one which includes adding board package.

https://www.youtube.com/watch?v=cbdFHmMOMwk&t=779s

This solved all my issues.

Thank you for explanation, this is also good thing to know as i move forward with a project.

Just a background info: i started without a kit, custom board, which did not had enough memory to include GUI and debug info on build. So i tried to use minimal components. After buying SNK1M1 kit + MCU board i found the correct video through references to the boards. It's way easier to strip out unwanted parts of code than guess what is missing :)