template (master branch) and source for hardware projects (other branches)
Go to file
2024-11-18 03:56:44 +01:00
firmware fw: show resistance measurement 2024-11-18 03:32:48 +01:00
kicad lib: add parts for interpreation 2024-03-18 01:53:28 +01:00
library@e5b0ca3a0f lib: update repo 2024-03-18 23:40:40 +01:00
picture doc: add pictures 2024-05-28 23:18:29 +02:00
.gitignore make: export 3d model 2024-03-08 07:14:21 +01:00
.gitmodules fw: add libopencm3 submodule 2024-05-28 23:33:46 +02:00
.qeda.yaml lib: add parts for interpreation 2024-03-18 01:53:28 +01:00
bom.ini make: include DNF parts 2024-03-08 07:14:21 +01:00
CHANGELOG.md doc: change DCC pull-down resistor 2024-11-18 03:56:44 +01:00
DEVELOPMENT.md doc: better list dependencies 2023-03-30 22:30:26 +02:00
fp-lib-table lib: add logos 2023-03-30 22:25:49 +02:00
KiBOM_CLI.py make: add bom generator (not included in pip) 2023-03-30 22:30:26 +02:00
LICENSE.txt add CERN-OHL-S license 2021-07-22 12:22:58 +02:00
Makefile switch to KiCAD8 2024-04-22 05:14:35 +02:00
README.md doc: add unusual states 2024-11-18 03:55:42 +01:00
sym-lib-table lib: add partdb library 2023-03-30 22:23:41 +02:00
usb-microbc_cable_tester-mcu.kicad_sch sch: too weak pull-down cause entring in bootloader 2024-08-31 17:08:05 +02:00
usb-microbc_cable_tester.kicad_pcb sch/brd: add 3V3 ADC and button input 2024-05-27 20:37:47 +02:00
usb-microbc_cable_tester.kicad_pro sch/brd: add 3V3 ADC and button input 2024-05-27 20:37:47 +02:00
usb-microbc_cable_tester.kicad_sch sch: fix VBUS resistor to match brightness 2024-08-31 17:09:08 +02:00
version switch to version 1 2024-03-17 08:12:11 +01:00

The USB micro-B and C cable tester identifies capabilities supported by USB cables and deduces their purpose. It helps figuring out if a USB cable is for charging or to transfer data, and at which speed. It supports type A to micro-B, A to C, and C to C USB cables.

usage

  • ensure the tester has a non-empty battery in the CR2032/2025 slot, or is externally powered through the USB power port
  • plug one end of the cable in one of the host ports
  • plug the other end of the cable in one of the devices ports
  • when using a battery, press on the BAT ON button
  • the tester will identify the cable's capabilities, on the left side
  • the tester will then show the cable's purpose, on the right side

Once I know it's purpose, I mark the cables with a letter:

  • USB A to micro-B only with ground and VBUS wires, limiting power transfer to 0.5 since they can't indicate battery charge: P
  • USB A to micro-B, with data line shorted internally to indicate 1.5A battery charge (even when not sure the host supports it): C
  • USB A to micro-B with data wires, but error prone since not shielded (sufficient for low speed): D
  • USB A to micro-B with shielded data wires (good for high speed): S
  • USB A to C without data lines but battery charge indication: C
  • USB A to C with unshielded data lines: D
  • USB A to C with SuperSpeed data lines, and shielded: 3
  • USB A to C with SuperSpeed data lines, but unshielded (thus faulty): D
  • USB C to C with shielded data lines: S
  • USB C to C with electronic marking allowing 5A charging: C
  • USB C to C with all features: F

The tester can detect electronically marked C to C cables. Electronically marked mean there is a chip on a least one of the C connectors. This is required in cables supporting 5A/100W charging. Some cable only supporting the default 3A/60W might also include it, but for cost reasons this is not common. But to be sure of the charging capability, one should read the information from the chip. This functionality is not supported by this tester. Full Feature C to C cable also require electronic marking, but could only support 3A charging. Because of that the 3A and 5A indicators are on at the same time (when the marking can be just for the features).

To understand further the capabilities and purpose of a cable, I recommend reading the USB specification, mainly the one for the type-C connector.

Unusual states:

  • when some LEDs on the CAPABILITIES side are on, but none on PURPOSE, the cable is missing the ground wire, making it faulty, and should immediately be thrown away.
  • on A-C cables, when the VBUS, DATA, and Rp LEDs are on, but it is decoded as faulty. I've seen this on a cables with built-in power display. Trust the decoding as it better measures the resistance in the CC pin. Rp is actually missing. The power monitor circuit in the cable creates a load (~ 50 kOhm) between VBUS and GND, interfering with the simpler Rp capability test.

report

There is a UART output on the debug port. The analysis of the capabilities to the purpose is periodically output on it. You can connect to it and view it using the 115200 8N1 baud rate.

firmware

You can flash or update the firmware using the SWD signals on the debug port, of also use the UART signals and the bootloader. To start the bootloader, press and hold the BL button while shortly pressing the RST button. You can then use stm32flash:

stm32flash -w binray.hex -v /dev/ttyACM0

The compiled binary is available in the release archives. The source code of the firmware is in the firmware folder.

design choice

features

do:

  • USB micro-B: still wide-spread and popular for charging devices
  • USB type-A: still the de-facto host plug
  • USB type-C: becoming the standard for battery operated devices
  • C to C: often used for high power charging of phones and laptops
  • battery operated: it's a very simple device, and this avoids needing to require external power
  • power port: in case you have no battery or it runs out
  • USB 3.0: because it is hard to identify if C-C cable support SuperSpeed
  • purpose: deduce from capabilities for users not knowledgable in USB cables

don't:

  • small: no need to build it as compact as possible
  • A to micro-B 3.0: the connectors that support it are obvious, and it's rare they are used for anything else than Super-Speed transfer (plus they are less common or problematic)
  • Power Delivery capabilities: this requires complex host software communicating with the eMarker chip in the cable
  • OTG: even if detecting this functionality is easy, micro-B OTG adapters are not popular anymore
  • impedance: only the presence of wires is tester, not their impedance

mode of operation

Most of the tests just verify if the wires corresponding to capabilities are present in the cable. Some additional tests verify the resistances in the plugs. For more details, check the schematic, and refer to type-C specification.

The left side identifies the capabilities. Based on that, a micro-controller (MCU) will map the combination into a purpose on the right side. The left side is independent of the MCU and right side.

limitation

The tester does not:

  • verify the resistance of wires, particularly the power ones
  • verify the impedance of wires, particularly the differential ones
  • verify if the shield(s) is more than just a wire
  • read out capabilities from electronically marked cables
  • guarantee USB cable compliance or conformity, as this is very complex

You can short the two pads marked BAT ON next to the battery with a solder blob. This will always power the board and does not require you to press on the BAT ON button to do the test, like when powering through the USB POWER port. But this will continuously drain 0.7 mA, emptying a CR2032 coin cell in 24 days.

alternatives