Application Description; Library Initialization - ST STM32 User Manual

Tcpm application
Hide thumbs Also See for STM32:
Table of Contents

Advertisement

UM2063
4.1.2

Application description

When the application starts, USB-PD has the capability of operating as either a Source or
Sink.
When connecting to a USB-PD device (source or sink), the application must detect the type
of connected device, and adopt a corresponding suitable role, in order to trigger the power
negotiation:
User must plug the USB-C™ cable on the dedicated connector.
When the STM32 MCU side behaves as a Consumer (Sink mode), i.e. when
connected to a Source device, it waits for Power Capabilities message from the
attached provider. When a Source Capabilities message is received, the STM32 starts
the evaluation of the received capabilities and check if one of the received power
objects can meet its power requirement. The STM32 sends the Request message to
request the new power level from the offered Source Capabilities. Once the PS_RDY
message is received, the Explicit Contract is established.
When the STM32 MCU side behaves as a Provider (Source mode), i.e. when
connected to a Sink device, it exchanges Power profiles with the connected device and
waits for Power Request message from the attached consumer. If the requested power
can be met, the STM32 MCU sends the Accept message followed by the PS_RDY
message. Explicit Contract is then considered as established.
4.1.3

Library initialization

To use and initialize the library, the user must follow the steps listed below.
1.
Include the STM32 USB-C™ PD core stack library in your project. Select library type
according to his toolchain, and according to features required to be supported (PD2.0
or PD3.0, VDM supported or not). Available libraries for the USB-PD core stack
component, are available in the directory
\Middlewares\ST\STM32_USBPD_Library\Core\lib\. A second library has to be
selected for the USB-PD component depending upon the used hardware kit
(P-NUCLEO-USB001 or P-NUCLEO-USB002), in the directory
\Middlewares\ST\STM32_USBPD_Library\Devices\. For P-NUCLEO-USB001 specific
case, select device source code from
\Middlewares\ST\STM32_USBPD_Library\Devices\STM32F072\ directory.
2.
Include the user application files in the application. Some examples of files are
available in the provided project examples in the firmware package. In provided
examples, user application files are:
main.c: Program Main file, includes main and System Clock configuration
functions. The program main function configures the MCU clock (template
implemented in the systemClock_Config() function in the main.c file of each
project example). Then, main calls the USBPD_HW_IF_GlobalHwInit() function to
initialize the hardware interface layer and calls the USBPD_DPM_Init() function to
UM2063 Rev 5
Examples description
13/18
17

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the STM32 and is the answer not in the manual?

Questions and answers

Table of Contents