USB Controller Firmware #
The USB controller on the TKey is a WCH CH552 with its own firmare.
The TKey, even the TKey Unlocked, usually comes with the USB controller firmware already flashed. If you need to change it for some reason, perhaps if you have an older TKey Unlocked and changes have been done to the CH552 firmware, you need to flash it yourself.
The firmware is kept in
usb_interface/ch552_fw.
To build it you need sdcc
. It’s included in the
[tkey-builder]((
https://ghcr.io/tillitis/tkey-builder) OCI image.
You also need chprog to actually flash the firmware.
You need a CH55x Reset Controller. You can buy it from Blinkinlabs or build it yourself. You need to perform this sequence:
- Disconnect both power and USB data lines from the device.
- Connect a 10k resistor from 3.3V to the D+ USB line.
- Connect the power and USB data lines to the device.
- After a short delay, disconnect the 10k resistor from the device.
To be able to use chprog without having to be root you have to install:
# CH552 bootloader (for unprogrammed CH552 chips)
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", ATTR{idVendor}=="4348", ATTR{idProduct}=="55e0", MODE="0666", GROUP="dialout"
in /etc/udev/rules.d
and do udevadm control --reload
.
To use the Blinkinlabs Reset Controller:
- Connect your computer to
DUT_IN
. - Connect the TKey to be flashed to
DUT_OUT
- Press the button marked “bootloader”. Note that there are two buttons.
- Run
make flash_patched
inhw/usb_interface/ch552_fw
which runs chprog.