0% found this document useful (0 votes)
4 views

WCHISPTool_CMD_CommandLineProgrammingToolInstruction (1)

WCHISPTool_CMD is a command line tool for programming WCH MCUs, supporting operations like firmware download and verification across multiple platforms including Windows, Linux, and macOS. The tool requires specific command formats for operations and provides a configuration file generated from WchIspStudio.exe. It also includes a source directory for custom development and detailed instructions for USB and serial port download modes.

Uploaded by

Nadeesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

WCHISPTool_CMD_CommandLineProgrammingToolInstruction (1)

WCHISPTool_CMD is a command line tool for programming WCH MCUs, supporting operations like firmware download and verification across multiple platforms including Windows, Linux, and macOS. The tool requires specific command formats for operations and provides a configuration file generated from WchIspStudio.exe. It also includes a source directory for custom development and detailed instructions for USB and serial port download modes.

Uploaded by

Nadeesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.

cn

WCHISPTool_CMD Command Line Programming Tool Instruction

1. Introduction
1.1 Software function
WCHISPTool_CMD is a multi-platform command line tool for WCH MCU burning online, which supports
firmware download, verification and other operations for series MCU of WCH through USB or serial port. The
tool contains ISP library and sample programs for customized development of ISP tool.
Supported operating system: Windows x86/x64, Linux x64, macOS x64/arm64.
Supported chip model: CH54x/ CH55x/ CH56x/ CH641x/ CH643x/ CH57x/ CH58x/ CH59x/ CH32F10x/
CH3F20x/ CH32V00x/ CH32V10x/ CH32V20x/ CH32V30x/ CH32X03x/ CH32L10x.

1.2 Command line


1.2.1 Download
USB mode:
sudo ./WCHISPTool_CMD -p /dev/ch37x -c Config.ini -o program -f Target.hex
Serial port mode:
sudo ./WCHISPTool_CMD -p /dev/ttyISP0 -b 115200 -c Config.ini -o program -f Target.hex

1.2.2 Verify
USB mode:
sudo ./WCHISPTool_CMD -p /dev/ch37x -c Config.ini -o verify -f Target.hex
Serial port mode:
sudo ./WCHISPTool_CMD -p /dev/ttyISP0 -b 115200 -c Config.ini -o verify -f Target.hex

1.2.3 Parameter description

Instruction description Parameters description


/dev/ch37x Download via USB in Linux
/dev/ttyISPx Download via serial port in Linux
-p USB ISP device or serial device node
LocationID Download via USB in macOS
COM(/dev/tty.*) Download via serial port in macOS

-b Communication baud rate of serial port 115200/230400/ Communication baud rate of serial port

-v Print version number boot/tool The boot/tool version

-c The full path name of the configure file xxx.ini The full/relative path

-o The type of operation program/verify Download/Verify

-f The name of Flash file xxx.hex/xxx.bin The full/relative path

Notes:
① All commands and parameters must appear in pairs in the format "-x xxx".
② Download or verify operation is required to pass in -p,-c,-o,-f instructions.

V3.60 1
WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.cn

③ For the confirmation method of the USB ISP device or serial port node name corresponding to the - p
command, see subsections 3.1 and 4.1.

1.3 Status code

Instruction description Parameters description

0 Execute successfully

1 Invalid input parameter

2 Failed to get parameters from the configuration file

3 Failed to set ISP parameters

4 The specified serial port name is invalid

5 No device enumerated

6 The specified chip type is not consistent with the actual chip type

7 Failed to get the device information

8 Invalid Flash file path

9 Invalid Flash file length

10 Failed to read the Flash file

11 Failed to convert the Flash file from HEX to BIN format

12 Failed to disable read protection

13 Failed to download

14 Failed to verify

100 Unknown error

1.4 Configuration file


The configuration file is generated by the "Save UI Config" function of WchIspStudio.exe in Windows. The
specific operations are as follows: First, open the software and select MCU series on the right side of the
software. Next, select series and model of the chip in the interface of “Chip Option” and configure the chip in the
interface of “Download Config”. Then click the main menu "File ->Save UI Config". Finally select the name and
location of the configuration file. The operation interface is as follows.

V3.60 2
WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.cn

1.5 Custom development


The src directory in each system folder contains the source files of the command line burning tool, which can be
directly developed based on this code to meet the customized demand of users. The lib directory contains the ISP
development dynamic library and header files. For functions and call instructions, users could refer to
WCH55XISPDLL. H and other header files in the lib directory.

2. Windows Platform
For details, please refer to: https://www.wch.cn/downloads/WCHISPTool_Setup_exe.html install path \
WCHISPTool_XXX\Doc.

3. Linux Platform
3.1 Instruction
3.1.1 USB download mode
① Plug USB
Make sure MCU is in BOOT download mode, and PID of USB device is 0x55e0.
② Install USB device driver
Open the system terminal, enter the driver folder, and execute the "make install" command.
This operation is only required for the first download.
③ Determine USB ISP device name
Use the "ls" command to check whether the /dev/ch37x character device exists.
④ Execute download instruction
Execute according to the instruction format requirements of the tool, for example,
sudo ./WCHISPTool_CMD -p /dev/ch37x0 -c Config.ini -o program -f Target.hex

3.1.2 Serial port download mode


① Connect MCU with serial port
Ensure MCU is in BOOT download mode.
② Create serial ISP device name
Confirm the serial port device node name, and then use the "ln" command to create a soft link named
"ttyISPx" for this device. The specific command is as follows.
sudo ln –s /dev/ttyUSB0 /dev/ttyISP0
③ Execute download instruction.
Execute according to the instruction format requirements of the tool, for example,
sudo ./WCHISPTool_CMD -p /dev/ttyISP0 –b 115200 -c Config.ini -o program -f Target.hex

V3.60 3
WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.cn

3.2 Run log file


3.2.1 The instance of successful download operation

3.2.2 The instance of failed download operation

3.2.3 The instance of getting the BOOT version separately

V3.60 4
WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.cn

3.2.4 The instance of getting the software version separately

4. macOS Platform
4.1 Instruction
4.1.1 USB download mode

① Plug USB
Make sure MCU is in BOOT download mode, and PID of USB device is 0x55e0.
② Determine the location ID of the USB device in the macOS system. Find the device in the System
Report ->Hardware ->USB. The location ID in the USB device tree is shown in the following figure.

③ Execute download instruction


Execute according to the instruction format requirements of the tool, for example,
sudo ./WCHISPTool_CMD -p 0x02131000 -c Config.ini -o program -f Target.hex

4.1.2 Serial port download mode


① Connect MCU with serial port
Ensure MCU is in BOOT download mode.
② Determine the node name of the serial port on the device, and run the "ls /dev/tty.*" command on the
terminal to check the serial port on the macOS(If the WCH serial port chip is used, install the

V3.60 5
WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.cn

CH34xVCPDriver of the macOS). A specific operation is shown in the figure below.

③ Execute download instruction


Execute according to the instruction format requirements of the tool, for example,
sudo ./WCHISPTool_CMD -p tty.wchusbserial214201–b 115200 -c Config.ini -o program -f Target.hex

4.2 Run log file


4.2.1 The instance of successful download operation

4.2.2 The instance of failed download operation

V3.60 6
WCHISPTool_CMD Command Line Programming Tool Instruction http://wch.cn

4.2.3 The instance of getting the BOOT version separately

4.2.4 The instance of getting the software version separately

V3.60 7

You might also like