-
Notifications
You must be signed in to change notification settings - Fork 28
Description
This commit
#109
added the command: wchisp config reset
This command is something deeply different then what you probably expect it to be. Its not a reset to default settings to remove animations you installed on the badge. Its changing deeper settings from the WCH chip. Its not solving #77
Could someone explain in combination with the badge hardware how its affecting things?
Here is the outcome:
The USB-C preproduction badge with the two additional buttons for games:
I was not able to flash this badge. The flash command always failed. But after i reset the config, i was able to flash the firmware. Sadly the badge have rows of broken LED's. Or maybe its now something WCH chip config related?
Here whole workflow from not be able to flash to verified flash from this preproduction board:
[INFO] Chip: CH582[0x8216] (Code Flash: 448KiB, Data EEPROM: 32KiB)
[INFO] BTVER(bootloader ver): 02.40
[INFO] Current config registers: ffffffffffffffffd50fff4f0002040009fa1c6232dc5738
RESERVED: 0xFFFFFFFF
WPROTECT: 0xFFFFFFFF
[0:0] NO_KEY_SERIAL_DOWNLOAD 0x1 (0b1)
- Enable [1:1] DOWNLOAD_CFG 0x1 (0b1)
- PB22(Default set)
USER_CFG: 0x4FFF0FD5
[2:0] RESERVED 0x5 (0b101)
- Default [3:3] CFG_RESET_EN 0x0 (0b0)
- Disable
[4:4] CFG_DEBUG_EN 0x1 (0b1)
- Enable [5:5] RESERVED 0x0 (0b0) [6:6] CFG_BOOT_EN 0x1 (0b1)
- Enable
[7:7] CFG_ROM_READ 0x1 (0b1)
- Read enable [27:8] RESERVED 0xFFF0F (0b11111111111100001111)
- Default
[31:28] VALID_SIG 0x4 (0b100)
`- Valid
[INFO] Firmware size: 175104
[INFO] Erasing...
[INFO] Erased 172 code flash sectors
[INFO] Erase done
[INFO] Writing to code flash...
[INFO] Code flash 175104 bytes written
[INFO] Verifying...
Error: Verify failed, mismatch
wchisp config reset
[INFO] Opening USB device #0
[INFO] Current config registers: ffffffffffffffffd50fff4f
[INFO] Reset config registers: ffffffffffffffff4fff0fd5
[INFO] Config register restored to default value(non-protected, debug-enabled)
[INFO] Current config registers: ffffffffffffffff4f3f0f450002040009fa1c6232dc5738
RESERVED: 0xFFFFFFFF
WPROTECT: 0xFFFFFFFF
[0:0] NO_KEY_SERIAL_DOWNLOAD 0x1 (0b1)
- Enable [1:1] DOWNLOAD_CFG 0x1 (0b1)
- PB22(Default set)
USER_CFG: 0x450F3F4F
[2:0] RESERVED 0x7 (0b111)
- Changed [3:3] CFG_RESET_EN 0x1 (0b1)
- Enable
[4:4] CFG_DEBUG_EN 0x0 (0b0)
- Disable [5:5] RESERVED 0x0 (0b0) [6:6] CFG_BOOT_EN 0x1 (0b1)
- Enable
[7:7] CFG_ROM_READ 0x0 (0b0)
- Disable the programmer to read out, and keep the program secret [27:8] RESERVED 0x50F3F (0b1010000111100111111)
- Changed
[31:28] VALID_SIG 0x4 (0b100)
`- Valid
[INFO] Firmware size: 175104
[INFO] Erased 172 code flash sectors
[INFO] Code flash 175104 bytes written
[INFO] Verifying...
[INFO] Verify OK
A Micro-USB badge:
Its bricked now. Its LED's flash just some times some LED's and otherwise it stay black.
[INFO] Current config registers: ffffffff23000000450fff4f
[INFO] Reset config registers: ffffffffffffffff4fff0fd5
[INFO] Config register restored to default value(non-protected, debug-enabled)
[INFO] Current config registers: ffffffffffffffff4f3f0f4500020400617fbe263b385ade
RESERVED: 0xFFFFFFFF
WPROTECT: 0xFFFFFFFF
[0:0] NO_KEY_SERIAL_DOWNLOAD 0x1 (0b1)
- Enable [1:1] DOWNLOAD_CFG 0x1 (0b1)
- PB22(Default set)
USER_CFG: 0x450F3F4F
[2:0] RESERVED 0x7 (0b111)
- Changed [3:3] CFG_RESET_EN 0x1 (0b1)
- Enable
[4:4] CFG_DEBUG_EN 0x0 (0b0)
- Disable [5:5] RESERVED 0x0 (0b0) [6:6] CFG_BOOT_EN 0x1 (0b1)
- Enable
[7:7] CFG_ROM_READ 0x0 (0b0)
- Disable the programmer to read out, and keep the program secret [27:8] RESERVED 0x50F3F (0b1010000111100111111)
- Changed
[31:28] VALID_SIG 0x4 (0b100)
`- Valid
[INFO] Firmware size: 175104
[INFO] Erasing...
[INFO] Erased 172 code flash sectors
[INFO] Erase done
[INFO] Code flash 175104 bytes written
[INFO] Verifying...
[INFO] Verify OK