Skip to content

Instantly share code, notes, and snippets.

@islandcontroller
Created January 1, 2025 21:57
Show Gist options
  • Save islandcontroller/3471f12531af31a620ddedeb062f4ca8 to your computer and use it in GitHub Desktop.
Save islandcontroller/3471f12531af31a620ddedeb062f4ca8 to your computer and use it in GitHub Desktop.
WCH-LinkE online update using Windows Sandbox

WCH-LinkE online update using Windows Sandbox

A guide on updating your WCH-LinkE Debugger without contaminating your host system

Prerequisites

Installing the USBIP client

  • Open an administrator cmd
CmDiag DevelopmentMode -on
CmDiag TestSign -on
  • Download usbip-win Version 0.3.5
  • Start Windows Sandbox and copy the downloaded file
  • Extract all
  • Install usbip_test.pfx
    • Local Machine
    • Password usbip
    • Install in:
      • Trusted Root Certification Authorities
      • Trusted Publishers
  • Open an administrator cmd and navigate to the extracted folder for usbip
.\usbip.exe install

Downloading the update tool and installing drivers

  • Download the WCH-LinkUtility
  • Copy it to Windows Sandbox
  • Extract all
  • Install drivers: Drv_Link\WCHLinkDrv_WHQL_S

Finding your host's IP address

  • Use ipconfig to find the IP address of the vEthernet Adapter (Default Switch)
    • Should have a subnet mask of 255.255.240.0
  • Ping it from Windows Sandbox and note the IP down for later

Connecting the WCH-LinkE to Windows Sandbox

  • Open the WCH-LinkE's case.
  • Insert it into a USB socket while holding down the IAP button (it should light up red and flash blue)
  • If this is the first time you use usbipd, open an admin shell on your host
    • usbipd list and look for "USB Module" with a VID:PID of 4348:55e0. Note the Bus-ID (first column)
    • usbipd bind --busid <...> with the Bus-ID from above (e.g. 12-2)
    • Done.
  • Open a user shell inside Windows Sandbox
    • usbip attach -r <host ip> -b <bus id> using your host's IP address and the Bus-ID from above

Updating the WCH-LinkE using WCH-LinkUtility

  • Start the WCH-LinkUtility.exe inside Windows Sandbox
  • Click on Target -> Connect WCH Link
    • A prompt appears, asking to perform an online update
    • Click yes.
  • If the update fails, disconnect and re-connect the WCH-LinkE (holding down the IAP button again). Afterwards, repeat the usbip attach command from above. Then, re-try the update.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment