Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CH592 to Readme #47

Merged
merged 1 commit into from
Mar 8, 2024
Merged

Add CH592 to Readme #47

merged 1 commit into from
Mar 8, 2024

Conversation

plops
Copy link
Contributor

@plops plops commented Mar 6, 2024

I used managed to program a board with CH592F using wchisp.
I bought it from here: aliexpress.us/item/1005006117859297.html

cl-cpp-generator2/example/146_mch_mcu/source06/b $ ./wchisp flash risc_usb_test
19:48:49 [INFO] Chip: CH592[0x9222] (Code Flash: 448KiB, Data EEPROM: 32KiB)
19:48:49 [INFO] Chip UID: DF-36-4F-10-53-5C-81-A3
19:48:49 [INFO] BTVER(bootloader ver): 02.30
19:48:49 [INFO] Current config registers: ffffffffffffffff4d0fff4f00020300df364f10535c81a3
RESERVED: 0xFFFFFFFF
WPROTECT: 0xFFFFFFFF
  [0:0]   NO_KEY_SERIAL_DOWNLOAD 0x1 (0b1)
    `- Enable
  [1:1]   DOWNLOAD_CFG 0x1 (0b1)
    `- PB22(Default set)
USER_CFG: 0x4FFF0F4D
  [2:0]   RESERVED 0x5 (0b101)
    `- Default
  [3:3]   CFG_RESET_EN 0x1 (0b1)
    `- Enable
  [4:4]   CFG_DEBUG_EN 0x0 (0b0)
    `- Disable
  [5:5]   RESERVED 0x0 (0b0)
    `- Default
  [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 0xFFF0F (0b11111111111100001111)
    `- Error
  [31:28] VALID_SIG 0x4 (0b100)
    `- Valid
19:48:49 [INFO] Read risc_usb_test as ELF format
19:48:49 [INFO] Found loadable segment, physical address: 0x00000000, virtual address: 0x00000000, flags: 0x5
19:48:49 [INFO] Section names: [".init"]
19:48:49 [INFO] Found loadable segment, physical address: 0x00000004, virtual address: 0x20000000, flags: 0x5
19:48:49 [INFO] Section names: [".highcode"]
19:48:49 [INFO] Found loadable segment, physical address: 0x00000240, virtual address: 0x00000240, flags: 0x5
19:48:49 [INFO] Section names: [".text"]
19:48:49 [INFO] Firmware size: 2048
19:48:49 [INFO] Erasing...
19:48:49 [WARN] erase_code: set min number of erased sectors to 8
19:48:49 [INFO] Erased 8 code flash sectors
19:48:50 [INFO] Erase done
19:48:50 [INFO] Writing to code flash...
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 2048/204819:48:50 [INFO] Code flash 2048 bytes written
19:48:50 [INFO] Verifying...
█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 2048/204819:48:50 [INFO] Verify OK
19:48:50 [INFO] Now reset device and skip any communication errors
19:48:50 [INFO] Device reset

I have to press the BOOT button while plugging in the USB-C cable.
Only then the USB device enumerates in Linux and wchisp can program.
I believe if I don't program the device immediatly, then after 10 seconds I have
to press BOOT again and plug USB again.

My code for the target is here: https://github.com/plops/cl-cpp-generator2/tree/master/example/146_mch_mcu/source06

@andelf
Copy link
Contributor

andelf commented Mar 8, 2024

Thanks for the info.

@andelf andelf merged commit ada36a4 into ch32-rs:main Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants