on 2024-12-09 07:44 AM
The USB Type-C® and USB PD specifications revolutionized device connectivity by merging data transfer and power delivery for up to 240 W (with EPR in USB PD 3.1). A key feature, fast role swap (FRS), allows a power supplying device quickly switch to a power-consuming role when it is subject to a power outage.
Let us consider a common scenario where a PC is connected to a docking station. The docking station acts as the power source, while the PC is the sink. If the docking station loses power, it must quickly signal an FRS to the laptop, which then becomes the new power source.
So, FRS is designed to ensure continuous power supply and preventing data loss during unexpected power interruptions. It allows devices to remain powered under different conditions. A device must switch from sinking power to sourcing power quickly enough to avoid any interruption.
Here is the full sequence extracted from USB PD specifications. The interaction of the policy engine (PE), user application, and PHY layer during a fast role swap involves several steps and timing parameters.
According to the specification, the critical point in the diagram is the time between when the source triggers the fast role swap (FRS) and when the sink becomes the source. During this time, the VBUS voltage drops and switches sources. This time interval must be very short to avoid disrupting the connected devices. This transition must happen within 150μs to prevent any disruption.
UCPD controller in STM32 fully manages standard role swap. Optionally, it can support fast role swap on some dual-role power controllers also called DRPs. FRS signaling and detection is detailed in section 13.4 in AN5225. Below is a summary of the messages involved in the fast role swap process after the source stops sourcing VBUS upon detecting a power outage.
Old source Old sink
According to your application, you need to manage VBUS monitoring properly in your end application.
Note: When operating as a source, you need to manage how to detect the disruption of the power supply and let the source trigger FRS.
For more details, check section 11.3.5 dual-role power port with FRS in AN5225.
The fast role swap feature is essential for maintaining uninterrupted power supply in USB, especially in scenarios where the primary power source fails. By leveraging the advanced capabilities of STM32, you can implement fast role swap efficiently, ensuring robust and reliable power delivery for your devices.