如何用WCH-LinkE-R0-1V2和MounRiver studio为CH32V003编程?

我很抱歉这个危险的中文翻译,但我是法国人,我不会说中文,这是一个自动翻译。


我在Tindie(https://www.tindie.com/products/adz1122/ch32v003-risc-v-mcu-development-board/)上买了一个开发包。

你可以在我的博客上看到我的开发冒险:http://www.fabienm.eu/wordpress/?p=1911


这个套件包括:

- 一块CH32V003开发板

- 一个WCH-LinkE-R0-1V2调试探头


我试图在芯片上下载一个简单的闪烁器 "hello world "项目,但没有成功。


我得到了 "电路板芯片状态错误"。


你知道我在哪里可以找到这个套件的好教程吗?


谢谢你。


-- English version

I'm sorry for this hazardous chinese traduction but I'm french and I don't speak chinese, it's an automatic translation.


I bought a developpement kit on Tindie (https://www.tindie.com/products/adz1122/ch32v003-risc-v-mcu-development-board/).

You can see my developpement adventure on my blog : http://www.fabienm.eu/wordpress/?p=1911


This kit is composed of :

- One CH32V003 dev board

- One WCH-LinkE-R0-1V2 debug probe


I'm trying to download a simple blinker ?hello world? project on chip without success.


I've got ?board chip status error?.


Do you know where I can found good tutorial for this kit ?


Thank you.



It seems you've too many wirings, they may be wrong. The only connection between linkE and the MCU should be:


SWDIO <-> D1/DIO@MCU

GND <-> GND@MCU

3V3 <-> 3V3@MCU (No need if you connect your MCU board with USB-C power supply)


Note the only wire for data communication between the MCU and linkE is SWDIO, it's a single wire, bi-direction data line. You do not need other wirings for flashing, debuging etc.


For a blinking LED, have a check the schematic, find out the GPIO the LED is connected to. Make sure to replace the PIN(default is D0) in sample project "GPIO_Toggle". OR you may simply add an LED and a resistor to D0 on your board. 


I believe the software is easy to follow, as long as you having a correct hardware connection. 


CH32V003 is a brand new MCU of WCH, which does not have official API references and tutorials, but only source codes. They debute a new product with lack of documents. Fortunately, their staffs are pretty nice to answer questions in this forum.


Good luck.


Thanks 李大文 for this response.


Are you sure about the only one wire (SWDIO) necessary to communicate with the chip ?

I plugged a scope on  SWCLK and SWIO and I can see signals on both. With a clock at about 480kHz.

SDS00006.png


Maybe the LinkE is not configured correctly ?


Note that the default program have a blinking red led when it's powered.


ch32v003_devkit.jpg


I re-tryied with the software given by adz1122

  but can’t communicate with CH32V003.

WCH-LinkUtility can get status of debug probe LinkE-R0-1v2 but can’t get CH32V003 status.


cf7a333993e2e2b318681f67f70adaa3752d3569.png


Log is :



20:30:47:295>> Succeed to connect with WCH-Link!
20:30:56:993>> Begin to set chip type…
20:30:57:046>> Failed,the chip type is not matched or status of chip is wrong!
20:35:17:316>> Failed to connect with WCH-Link!Please affirm link is at RISC-V mode!
20:35:22:603>> Begin to set chip type…
20:35:22:666>> Failed,the chip type is not matched or status of chip is wrong!
20:35:23:839>> Begin to set chip type…
20:35:23:908>> Failed,the chip type is not matched or status of chip is wrong!
20:37:48:109>> Succeed to connect with WCH-Link!
20:38:37:098>> Begin to set chip type…
20:38:37:161>> Failed,the chip type is not matched or status of chip is wrong!
20:38:39:421>> Succeed to connect with WCH-Link!
20:38:51:237>> Begin to set chip type…
20:38:51:291>> Failed,the chip type is not matched or status of chip is wrong!
20:40:20:238>> Succeed to connect with WCH-Link!
20:40:25:038>> Begin to set chip type…
20:40:25:085>> Failed,the chip type is not matched or status of chip is wrong!


Hello, first check whether the mode of WCH-LinkE is in RV mode. If not, set it to RV mode, and then connect MCU to download. The mode viewing mode and setting mode are shown in the figure below

image.png


I just tested it and yes it's in RV mode. But If I try to get chip status I get this error :


Failed,the chip type is not matched or status of chip is wrong!


The chip on my devkit is a CH32V003 F4P6

But it seems to not be recognized by LinkE-R0-1V2 probe.


I have not tried flashing with the GUI utility yet, but I can confirm that MounRiver Studio's OpenOCD can flash the chip as expected with WCH-LinkE.


I tryied with openocd provided by MRS_Toolchain_Linux_x64_V1.60 on Linux with command line :


$ cd /home/user/MRS_Toolchain_Linux_x64_V1.60/OpenOCD/bin
$ ./openocd -f wch-riscv.cfg
Open On-Chip Debugger 0.11.0+dev-02215-gcc0ecfb6d-dirty (2022-10-10-10:35)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
Ready for Remote Connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : WCH-LinkE-CH32V307  mod:RV version 2.7
Error:  WCH-Link failed to connect with riscvchip
Error:  1.Make sure the two-line debug interface has been opened. If not, set board to boot mode then use ISP tool to open it
Error:  2.Please check your physical link connection



Openocd detect a WCH-LinkE but with CH32V307. According to chip labelling, the chip mounted on my WCH-LinkE seems to be a CH32V305 no ?


IMG_20221212_205906.jpg


Maybe the commands arguments are wrong ?



Is there a procedure I forget to place CH32V003 devkit in "programming mode" ?


Because as soon as I power it, the blinking led demo soft start.


download.jpg

linke 连接无误点download  


Thanks 智峰科技,


But where can I get this IDE 'RISC-V IDE' ?




So, anyone have a clue why I can't communicate with the CH32V003 via the LinkE?


只有登录才能回复,可以选择微信账号登录