This software guide is a non-exhaustive document aimed at clarifying a good practice when the customized STUSB4500
software is being written.
Figure 1. STEVAL-ISC005V1
Table 1. Minimal configuration
1 x NUCLEO-F072RBSTM32 Nucleo-64 development board with ARM Cortex M0
1 x STEVAL-ISC005V1STUSB4500 evaluation board
STSW-STUSB003
IAR 8.xC code compiler
UM2650 - Rev 2 - December 2020
For further information contact your local STMicroelectronics sales office.
Software library including STUSB4500 hardware abstraction layers, drivers and
code example
www
.st.com
1How to?
1.1How USB PD negotiation works
1.At connection, a source connects to a sink @ 5 V (Type-C), therefore first of all, the STUSB4500 advertises
itself as a USB T
Then, a USB PD capable source advertises its power budget (SRC_PDOj) to the STUSB4500.
2.
3.The sink (STUSB4500) is responsible for:
a.evaluating the SRC_PDOj according to application needs (stored in STUSB4500 SNK_PDOi) thanks to
an internal algorithm
b.sending a request (voltage, current) to the SOURCE if any of the SRC_PDOj is compatible with any
SNK_PDOi (power MATCH). In case of failure, the negotiation ends with a USB PD mismatch.
4.The SOURCE is responsible for:
a.accepting or declining the request (RDO) sent by the STUSB4500.
b.if accepted, implementing the voltage and current transition from current profile to the new power
profile (within 275 ms after "accept")
c.notifying the SINK about the transition to new power profile is completed (PS_READY)
ype-C SINK.
UM2650
How to?
Figure 2. USB PD negotiation
1.2How to initialize the STUSB4500 properly
In order to properly initialize the STUSB4500 for software operations, it is recommended to:
1.Clear all interrupts by reading (I²C multi-read command for instance) all 10 registers from address 0x0D to
0x16
2.
Configure interrupt mask register (@0x0C) according to application requirements (recommended list of
alerts to be unmasked: CONNECTION_STATUS, MONITORING_STATUS, PRT_STATUS)
For further details, see the STSW-STUSB003 function: usb_pd_init
UM2650 - Rev 2
page 2/49
1.3How to send a USB PD software reset
In order to send a USB PD “SOFT_RESET_MESSAGE” command, the following sequence must be done:
1.WRITE 0x0D (SOFT_RESET) in the TX_HEADER_LOW register (@0x51)
2.
WRITE 0x26 (SEND_COMMAND) in the PD_COMMAND_CTRL register (@ 0x1A)
For further details, see STSW-STUSB003 function Send_Soft_reset_Message
1.4How to fill the PDO registers
The STUSB4500 supports up to 3 fixed supply PDO. As per USB PD standard, a SINK PDO is composed 32 bits
that must be filled according to figure below
PDO1, PDO2 and PDO3 from the STUSB4500 can be changed by software by accessing respectively the
registers 0x85-0x88, 0x89-0x8C and 0x8D-0x90. Each PDO is composed of a word of 4 bytes. Please note PDO1
must be fixed 5 V according to USB PD standard.
BitsDescription
B31...30Fixed supply
B29Dual-role power
B28Higher capability
B27Unconstrained power
B26USB communication capable
B25Dual-role data
B24..23
B22..20Reserved-Shall be set to zero
B19...10V
B9...0Operational current in 10 mA units
.
able 2. Fixed supply PDO-sink
T
Fast role swap required USB-Type-C current:
- 00b: fast swap not supported (default)
- 01b: default USB power
- 10b: 1.5 A@5 V
- 1
1b: 3.0 A@5 V
oltage in 50 mV units
UM2650
How to send a USB PD software reset
Filling the PDO register only does not force new PDO contract negotiation. Please check Section 1.5 How to
force the STUSB4500 to re-negotiate with the SOURCE.
For further details, see STSW-STUSB003 function:
Update_PDO
1.5How to force the STUSB4500 to re-negotiate with the SOURCE
As per USB PD standard, a new contract negotiation must occur when a SOFT_RESET_MESSAGE is sent (by
either the SOURCE or the SINK).
Therefore, once the PDO registers have been updated by software, sending a SOFT_RESET_MESSAGE to the
SOURCE a new USB PD negotiation starts, by taking into account the new STUSB4500 PDO values (please
check Section 1.3 How to send a USB PD software reset).
1.6How to force VBUS to 5 V
An easy way to force the STUSB4500 to negotiate 5 V is to set the number of active PDO to 1 (cf register 0x70:
DPM_PDO_NUMB register) followed by a SOFT_RESET_MESSAGE (please check Section 1.3 How to send a
USB PD software reset).
For further details, see STSW-STUSB003 functions: Negotiate_5V
UM2650 - Rev 2
, Update_Valid_PDO_Number
page 3/49
UM2650
How to read USB-C connection STATUS
1.7How to read USB-C connection STATUS
By accessing the 2 registers below:
•POR
T_STATUS_1 (@0x0E)
•CC_STATUS (@0x11)
It is possible to report the following information to the application processor:
1.the plug orientation (CC pin attached to CC1 or CC2)
2.the USB-C source current (Rp resistor value)
Note:At the connection, the STUSB4500 connects first in USB-C mode before negotiating any USB PD contract. In
order to know the final connection status (USB-C or USB PD explicit contract), it is recommended to wait 500 ms
after ATTACH event.
For further details, see STSW-STUSB003 function: Print_Type_C_Only_Status
1.8How to read USB PD STATUS
By accessing the 4 registers below:
•
RDO_REG_ST
•RDO_REG_STATUS_1 (@0x92)
•RDO_REG_STATUS_2 (@0x93)
•RDO_REG_STATUS_3 (@0x94)
it is possible to report to the application processor some information:
•if the STUSB4500 is attached in USB-C mode (object position = 000b) or in USB PD contract (object
position different from 000b)
•the PDO index from the SOURCE that has been requested by the STUSB4500 internal algorithm (if object
position is different from 000b)
•and various information as per USB PD standard definition (see table below)
ATUS_0 (@0x91)
Table 3. Fixed request data object RDO
BitsDescription
B31Reserved-Shall be set to zero
B30....28Object position (000b is Reserved and
B27GiveBack flag = 0
B26Capability mismatch
B25USB communications capable
B24No USB suspend
B23Unchunked extended messages supported
B22....20Reserved-Shall
B19...10Operating current in 10 mA units
B9..0Maximum operating current 10 mA units
be set to zero
For further details, see STSW-STUSB003 function: Print_RDO;
1.9How to access to the PDO from the SOURCE
As a normal process from the USB-PD negotiation (see Section 1.1 How USB PD negotiation works),
the SOURCE initiates a USB PD contract negotiation by sharing its POWER profile (SRC_PDO) with the
STUSB4500.
It is possible to access these power profiles at the beginning of the power negotiation by reading the RX_Buffer
after confirmation from PR
T_STATUS register. This dynamic register flags each incoming message.
Shall Not be used)
UM2650 - Rev 2
page 4/49
How to access the STUSB4500 policy engine state
When an incoming message is reported, its content is temporarily stored in the RX buffers (from 0x31 to 0x4E).
As each incoming message overrides the former message, it is important to quickly store in application processor
memory the STUSB4500 RX buffer content (header + data object) in order to catch the SOURCE power profiles.
1.10How to access the STUSB4500 policy engine state
In order to understand what is the current state of the USB PD negotiation, it is possible to monitor in real time
the STUSB4500 policy engine FSM. Please refer to PE_FSM register (@0x29) or check Get_Device_STA
function from the STSW-STUSB003 library.