Skip to content

Feature request: add write protection support #107

@dariocorse

Description

@dariocorse

I’ve implemented raw config write support for wchisp in my fork and tested it on CH32V203C8T6 and would like to propose it for inclusion.

It adds wchisp config set , which accepts either:

  • the 12 writable config bytes, or
  • the full 24-byte config info dump, in which case only the first 12 writable bytes are written back.

The implementation performs a readback check after writing.

Because protection-related config changes can be risky on some chips, I wanted to check whether you’d accept a PR before I open one.

Tested on:

  • chip: CH32V203C8T6
  • bootloader version: 02.70
  • transport: USB ISP

Safety notes:

  • On this chip, the feature is reversible: I was able to restore the previous state by writing back the corresponding config bytes, and config unprotect also restores the unprotected state.
  • On my device, RDPR affects readout, but WRP does not appear to block USB ISP flashing via wchisp. In addition, WCH-Link / wlink flash appears to implicitly clear both read and write protection before
    flashing.
  • I have only tested this on CH32V203C8T6. I have not validated the behavior on other families yet, especially chips with known config-read/write quirks.

I can also add docs/help text and warnings if that would make the PR more useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions