Close

Firmware update, read key from data flash

A project log for RGB macropad custom firmware

Custom firmware for the CH552 found in those USB RGB macropads with a rotaty knob

biemsterbiemster 03/31/2023 at 10:120 Comments

So at the very end I did still run into some issues, where this project started so expeditious. The main issue was that I couldn't start the bootloader by pressing a key when connecting to USB, a feature I really wanted to reprogram the keys. The problem was that with CH55xduino I couldn't seem to jump to the bootloader at #3800 from user code.

With the help of @Stefan Wagner I decided to move away from CH55xduino, and base the code off of his implementations in wagiminator/CH552-Macropad-mini and wagiminator/CH552-USB-Knob.

The firmware in the git repository is now a complete rewrite, and includes a nice flashing tool. First time programming still needs a hardware connection to be made between P1.5 and GND, but after that holding the 1st key while connecting USB lands you in the bootloader!

And as an added feature, the keys the pad sends are now stored in EEPROM, since the ROM has an guaranteed write lifetime of only 200 writes. So reprogramming the keys does not count towards that anymore.

This reprogramming the keys requires a bit of fiddling now, with reading the data flash like this:

$ isp55e0 --data-dump flashdata.bin

then change the first 6 bytes of this binary files to your liking (3 keys, plus 3 for the knob), and writing it back:

$ isp55e0 --data-flash flashdata.bin

There are other tools out there to do this, I just happened to have isp55e0 installed. Last thing to do is write a small python script that does this for you, and it's a wrap-up!

Discussions