7QXQWB5

CH552 software emulation USB PD decoy

 
Overview

More information can be found in the example code in ch55xduino.
This project uses a general-purpose microcontroller (CH552) to receive and send USB PD signals via the CC line, without any peripherals. Only an analog comparator and a timer are used to receive signals. GPIOs with clamping diodes are used to send signals. The example code makes the CH552 act as a USB PD SINK controller and requests a programmable voltage from the PD/PPS charger.
This approach can also be ported to any general-purpose microcontroller with a comparator, ADC, and digital output.
For a simpler circuit, the CH549 can also be used. The same code will significantly simplify the peripheral circuitry by utilizing the internal voltage reference and low-voltage output capability.
How it works:
USB PD exchanges data between the source and sink devices via the CC line in the USB Type-C connector using the BMC (Biphase Mark Code). However, the maximum communication voltage is approximately 1~1.2V, so it cannot be directly interconnected with the microcontroller's I/O ports.
On the input side, an analog comparator compares the signal to a 0.6V reference voltage, thus converting the signal into a digital signal. The software uses a timer to measure the time difference between transitions and decodes the BMC into binary.
On the output side, the output voltage is clamped to 1V through a 1K resistor, a general-purpose diode, and two Schottky diodes. The cathode of a series diode is connected to another GPIO, making the clamping controllable. Therefore, any digital output will be clamped to 0-1V.
After the signal is decoded from the BMC, the software looks for a preamble consisting of alternating 1s and 0s. Once the preamble ends, the software records the binary data in 5-bit groups. After the preamble ends, we check the SOP, perform 5b4b decoding, and check the CRC. If everything is normal, we parse the data packet using the USB PD protocol.
The data transmission process is similar: we generate a CRC, encode the data using 4b5b, add the SOP and EOP, and then encode the data back using the BMC.
参考设计图片
×
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2026-03-27 19:58:07

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号