tillitis-key/hw/boards/mta1-usb-v1/ch552_fw
Matthew Mets 072b204d3d
Add (hardware) production tests for the TK-1 and TP-1 (#69)
* ch552 firmware: add ch55x support files directly

* Add sdcc compiler to docker image, for building CH552 firmware

* Rework production test script

* Add menu-based test runner
* Rewrite production test flows as lists of individual tests
* Add both production flows and manual tests to menu

* Switch to using included binaries

* production test: Update message format
* test_txrx_touchpad: Retry if device communications fail
* production test: put all binaries in binaries/ folder
* binaries/top.bin: replace broken binary

* flash_check: Check for explicit flash IDs

* Document most test procedures

* Test plan documentation

* Sample udev rules

* Production test: allow external references to be overridden

* Remove outdated descriptions

* Correct shebang

* Update shebangs to comply with PEP 394

Change the python scripts to call python instead of python3, as this
works cross platform. See:
https://peps.python.org/pep-0394/#for-python-script-publishers

* Move production test to higher-level directory

* Clarify production test setup

* Move USB C connector test to separate directory

Co-authored-by: Michael Cardell Widerkrantz <mc@tillitis.se>
2023-01-11 16:33:01 +01:00
..
include Add (hardware) production tests for the TK-1 and TP-1 (#69) 2023-01-11 16:33:01 +01:00
.gitignore Make initial public release 2022-09-19 08:51:11 +02:00
baud rate calculator.ods Make initial public release 2022-09-19 08:51:11 +02:00
encode_usb_strings.py Make initial public release 2022-09-19 08:51:11 +02:00
inject_serial_number.py Make initial public release 2022-09-19 08:51:11 +02:00
LICENSE Ch552 license (#65) 2023-01-03 15:48:53 +01:00
main.c Make initial public release 2022-09-19 08:51:11 +02:00
Makefile Add (hardware) production tests for the TK-1 and TP-1 (#69) 2023-01-11 16:33:01 +01:00
Makefile.include Add (hardware) production tests for the TK-1 and TP-1 (#69) 2023-01-11 16:33:01 +01:00
README.md Add (hardware) production tests for the TK-1 and TP-1 (#69) 2023-01-11 16:33:01 +01:00
usb_strings.h Make initial public release 2022-09-19 08:51:11 +02:00

CH552 USB-to-Serial firmware

Toolchain setup

SDCC:

sudo apt install build-essential sdcc

chprog (for flashing the firmware to a device):

cd ~
sudo apt install libusb-1.0-0-dev
git clone https://github.com/ole00/chprog.git
cd chprog
./build_linux.sh
sudo cp chprog /usr/local/bin

Usage

Build the firmware using a default serial number:

make

Flash the firmware to a device:

make flash_patched

Re-programming the firmware

By design, once the USB to serial firmware is loaded onto the chip, there isn't an intended way to reflash it using only software. However, if 3.3V is applied to the D+ line through a 10K resistor during power-up, then the CH552 will enter bootloader mode, and a new firmware can be programmed onto the chip. Note that the CH552 flash is only guaranteed for a few hundred flash cycles.