Gigabit RISC-V GD32VF103 debugging tool introduction
[Copy link]
There are not many debugging tools available for RSCV microcontrollers. For GD32VF103, only gd-link is recommended by the manufacturer. Here I would like to share with you a simple way to use the FT232 series high-speed port module to make a debugging and downloading tool. I would also like to share with you the pitfalls in the hardware and software when making this debugging tool.
1. The hardware must use FT232H, FT2232H, FT4232H and other hardware with suffixes without HL or HQ. These series support high-speed USB, and those with suffix D only support full speed; these modules can be bought on Taobao for dozens of yuan, and you can also solder them yourself if you are interested;
2. After the hardware module is purchased and manufactured, the EEprom of 93C55 and other modules is empty. Before inserting the hardware USB port into the computer, install the FTDI official driver CDM v2.12.28 WHQL Certified and the EEprom configuration software FT_Prog. Use FT_Prog to configure the driver of the hardware portA or portB to D2xx mode. No other changes are required. Remember to write the configuration after configuration;
3. Some online tutorials recommend using Zadig to force the driver from libusb to winusb. This step is not necessary after verification. When using openocd for debugging, openocd directly uses the D2xx driver. If forced to change to winusb, FT_prog will not be able to recognize the hardware and needs to be changed back to libusb. You can use it according to your own situation;
4. Openocd interface configuration, FT232, FT2232, FT4232 have the same vid, but different pid, so in the configuration interface file, ftdi_vid_pid 0x0403 0x6010 #ftdi_vid_pid 0x0403 0x6014 needs to be modified according to the module used, FT232 is 0x6014, FT2232 is 0x6010, FT4232 is 0x6012. In the configuration file, port pin configuration needs to be used for SRST, such as ftdi_layout_signal nSRST -oe 0x0040 -data 0x0040, the four signals of JTAG use 1--4 respectively, so the following 5-8 can be allocated, and here 0x0040 is binary 00100000; Therefore, NRST uses the 6th pin.
5. In the interface configuration, you need to use adapter_khz 20000 to configure the speed. The example configuration is 20M. After use, it can be configured to 30M at the highest, but the stability is not good. 20M can run very stably;
6. Used for GD32VF103 debugging, usually openocd is used. You can download the official version of openocd on the Internet. This version can be connected, but the flash writing and debugging will exit due to errors at the flash recognition. The main reason is that the GD32VF series target configuration file on the official website does not configure the flash. In addition, the official version has not yet added the driver for the GD32VF103 flash. Therefore, you must use the openocd version provided by the Xinlai official website. In this customized version, there is a customized GD32VF103 flash driver. set _FLASHNAME $_CHIPNAME.flash flash bank $_FLASHNAME gd32vf103 0x08000000 0 0 $_TARGETNAME
7. This tool can also be used for ARM debugging. It can support both JTAG and SWD modes, but the SWD mode requires appropriate hardware changes. There are many tutorials on the Internet. The interfacd and target configuration files of openocd are in my previous use of VS code for gdvf103 debugging, which you can refer to.
|