Dobrica Pavlinušić's random unstructured stuff
CH552G: Revision 9

https://altbier.us/ch552g/Intro_to_the_CH552G_Microcontroller.pdf

RGB micropad 3 keys 1 rotary encoder

RGB micropad with three buttons and rotary encoder based on CH552G

https://github.com/eccherda/ch552g_mini_keyboard/

https://hackaday.io/project/189914-rgb-macropad-custom-firmware

https://github.com/biemster/3keys_1knob

fork with hid sending (which somehow doesn't work) https://github.com/mgrenonville/3keys_1knob/tree/serial

fork with ability to send sequence of keys (with different eeprom config) https://github.com/MrGeorgeK55/Macropad-3-keys-1-knob

flashing tools

https://github.com/MarsTechHAN/ch552tool

https://github.com/rgwan/librech551

https://github.com/frank-zago/isp55e0 - can read and write flash data

usb original

[Thu Dec 12 11:24:45 2024] usb 3-3.3.4.4: new full-speed USB device number 28 using xhci_hcd
[Thu Dec 12 11:24:45 2024] usb 3-3.3.4.4: New USB device found, idVendor=1189, idProduct=8890, bcdDevice= 0.00
[Thu Dec 12 11:24:45 2024] usb 3-3.3.4.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[Thu Dec 12 11:24:45 2024] input: HID 1189:8890 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.0/0003:1189:8890.0022/input/input70
[Thu Dec 12 11:24:46 2024] hid-generic 0003:1189:8890.0022: input,hidraw6: USB HID v1.11 Keyboard [HID 1189:8890] on usb-0000:00:14.0-3.3.4.4/input0
[Thu Dec 12 11:24:46 2024] usbhid 3-3.3.4.4:1.1: couldn't find an input interrupt endpoint
[Thu Dec 12 11:24:46 2024] input: HID 1189:8890 Keyboard as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.2/0003:1189:8890.0023/input/input71
[Thu Dec 12 11:24:46 2024] hid-generic 0003:1189:8890.0023: input,hidraw7: USB HID v1.00 Keyboard [HID 1189:8890] on usb-0000:00:14.0-3.3.4.4/input2
[Thu Dec 12 11:24:46 2024] input: HID 1189:8890 as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.3/0003:1189:8890.0024/input/input72
[Thu Dec 12 11:24:46 2024] hid-generic 0003:1189:8890.0024: input,hidraw8: USB HID v1.10 Mouse [HID 1189:8890] on usb-0000:00:14.0-3.3.4.4/input3

after shoring unpopulated pad on bottom of board and plugging back in to enter bootloader mode

[Thu Dec 12 11:31:40 2024] usb 3-3.3.4.4: new full-speed USB device number 29 using xhci_hcd
[Thu Dec 12 11:31:40 2024] usb 3-3.3.4.4: New USB device found, idVendor=4348, idProduct=55e0, bcdDevice= 2.40
[Thu Dec 12 11:31:40 2024] usb 3-3.3.4.4: New USB device strings: Mfr=0, Product=0, SerialNumber=0

Arduino

After compiling and flashing doesn't work with error because of permissions to device in bootloader mode.

Re-run flashing command with sudo:

dpavlin@nuc:~$ sudo /home/dpavlin/.arduino15/packages/CH55xDuino/tools/MCS51Tools/2023.10.10/linux/vnproch55x -r 2 -t CH552 -c 3 /tmp/arduino_build_734169/ch552g_mini_keyboard.ino.hex
------------------------------------------------------------------
CH55x Programmer by Deqing
Updated on: 2023/10/10
------------------------------------------------------------------
usbRertySeconds 2
target: CH552
config bytes: 3
Load file as hex
   Loaded 12673 bytes between: 0000 to 31CE
DeviceVersion of CH55x: 2.40
MCU ID: 52 11
Found Device CH552
Bootloader: 2.4.0
ID: 4E 8F 51 BC
XOR Mask: EA EA EA EA EA EA EA 3C
Write 12751 bytes from bin file.
..................................................
Write complete!!!
Verify chip
..................................................
Verify complete!!!
------------------------------------------------------------------
Reset OK

dpavlin@nuc:~$ 

[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: USB disconnect, device number 29
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: new full-speed USB device number 30 using xhci_hcd
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: New USB device found, idVendor=1209, idProduct=c55d, bcdDevice= 1.00
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: Product: CH55xduino
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: Manufacturer: Deqing
[Thu Dec 12 11:36:59 2024] usb 3-3.3.4.4: SerialNumber: CH55x kbd mos
[Thu Dec 12 11:36:59 2024] input: Deqing CH55xduino Keyboard as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.0/0003:1209:C55D.0025/input/input73
[Thu Dec 12 11:36:59 2024] input: Deqing CH55xduino Mouse as /devices/pci0000:00/0000:00:14.0/usb3/3-3/3-3.3/3-3.3.4/3-3.3.4.4/3-3.3.4.4:1.0/0003:1209:C55D.0025/input/input74
[Thu Dec 12 11:36:59 2024] hid-generic 0003:1209:C55D.0025: input,hidraw6: USB HID v1.10 Keyboard [Deqing CH55xduino] on usb-0000:00:14.0-3.3.4.4/input0
[Thu Dec 12 14:40:42 2024] input: WH-1000XM5 (AVRCP) as /devices/virtual/input/input75

better yet, copy udev rules

dpavlin@nuc:~/.arduino15/packages/CH55xDuino/tools/MCS51Tools/2023.10.10$ sudo cp -v linux/99-ch55xbl.rules /etc/udev/rules.d/
'linux/99-ch55xbl.rules' -> '/etc/udev/rules.d/99-ch55xbl.rules'

root@nuc:~# udevadm control --reload-rules && udevadm trigger