Custom USB connection

Thread Starter

Samantha Groves

Joined Nov 25, 2023
161
I broke a USB-Type C cable again. One side of the cable is intended for connecting to a computer case, while the other side (the one I broke) is intended for charging your tablet or phone. I know for sure that if you take the 5V and GND wires of this broken USB cable, you could use it to power a custom electronics project. However, recently I have been more interested in something else. Let's say you want to send information to your connected computer from custom electronics via the D+ and D- pins. Question a) Is this possible?
Question b)What kind of encoding would you need to follow?You can make a custom clock to emulate the baud rate but I am anaware of the encoding of the information in order to be read by the computer as readable data.Thanks
 
Last edited:

MrChips

Joined Oct 2, 2009
34,666
Here are reasons why emulating your own USB is not a walk in the park:

1) Notice that the data lines are D+ and D-. There is no CLOCK signal. D+ and D- mean that the signal is differential. USB 2.0 runs at 480 Mbps while USB 3.0 runs at 5 Gbps. USB4 runs at 40 Gbps. The data is self-clocking.

2) Data is bidirectional, meaning that both host and device can send and receive data.

3) Before data is transmitted via USB, the two devices have to connect and identify themselves. The type of communication has to be negotiated and established. All data is transmitted in packets. It is not as easy as a simple byte transfer such as UART interface.

CP2102 USB-to-UART bridge is the simplest technique to send UART data via USB.
 

GetDeviceInfo

Joined Jun 7, 2009
2,270
I broke a USB-Type C cable again. One side of the cable is intended for connecting to a computer case, while the other side (the one I broke) is intended for charging your tablet or phone. I know for sure that if you take the 5V and GND wires of this broken USB cable, you could use it to power a custom electronics project. However, recently I have been more interested in something else. Let's say you want to send information to your connected computer from custom electronics via the D+ and D- pins. Question a) Is this possible?
Question b)What kind of encoding would you need to follow?You can make a custom clock to emulate the baud rate but I am anaware of the encoding of the information in order to be read by the computer as readable data.Thanks
Your easiest approach would likely be finding an Arduino based device with USB peripheral, loading some of the widely available code, and go from there. How you handle the data on the PC side is another story. What makes the UART to USB bridge so attractive, is that data on the PC side is easily accessed via a virtual port driver.
 
Top