In this tutorial, I would like to talk about how to use the ultra budget JTAG debuggers CJMCU FT232H and RV-Debugger-Lite in PlatformIO to flash and debug devices on ESP32 and GD32 platforms. I did not find a complete instruction on the Internet, and during the setup process I ran into many problems, so this tutorial appears here for your convenience. I will make a reservation right away that the setting is written for Linux, but for Windows there is no fundamental difference except for dancing with Zadig.
CJMCU FT232H + ESR32 Rev1 aka ESP32Dev
I mean this debugger based on the FT232H chip:
And here is this board based on ESP-WROOM-32:
Platformio.ini settings:
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
monitor_speed = 115200
upload_speed = 921600
debug_tool = minimodule
upload_protocol = minimodule
Here we have a CJMCU FT232H for 700 rubles will pretend to be a FT2232H MINI MODULE debugger for 4500. To do this, you need to make the following changes to the file (the lines I commented out start with ##):
/home/<username>/.platformio/packages/tool-openocd-esp32/share/openocd/scripts/interface/ftdi/minimodule.cfg
#
# FTDI MiniModule
#
# http://www.ftdichip.com/Support/Documents/DataSheets/Modules/DS_FT2232H_Mini_Module.pdf
#
interface ftdi
##ftdi_device_desc "FT2232H MiniModule"
##ftdi_vid_pid 0x0403 0x6010
ftdi_vid_pid 0x0403 0x6014
# Every pin set as high impedance except TCK, TDI, TDO and TMS
ftdi_layout_init 0x0008 0x000b
# nSRST defined on pin CN2-13 of the MiniModule (pin ADBUS5 [AD5] on the FT2232H chip)
# This choice is arbitrary. Use other GPIO pin if desired.
##ftdi_layout_signal nSRST -data 0x0020 -oe 0x0020
## added
# interface 1 is the uart
ftdi_channel 0
reset_config none
minimodule"ftdi_device_desc",
CJMCU FT232H . VID/PID, :
/etc/udev/rules.d/99-platformio-udev.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="6014",
GROUP="plugdev", MODE="0666"
.
:
JTAG |
CJMCU FT232H |
ESP32Dev |
TDO |
AD2 |
GPIO15 |
TDI |
AD1 |
GPIO12 |
TCK |
AD0 |
GPIO13 |
TMS |
AD3 |
GPIO14 |
|
+3.3V |
3V3 |
|
GND |
GND |
CJMCU FT232H + Sipeed Longan Nano
GD32VF103CBT6:
platformio.ini:
[env:sipeed-longan-nano]
platform = gd32v
framework = gd32vf103-sdk
board = sipeed-longan-nano
monitor_speed = 115200
debug_tool = um232h
upload_protocol = um232h
CJMCU FT232H UM232H 2000 . :
/home/<username>/.platformio/packages/tool-openocd-gd32v/share/openocd/scripts/interface/ftdi/um232h.cfg
#
# FTDI UM232H as a JTAG interface
#
# http://www.ftdichip.com/Products/Modules/DevelopmentModules.htm#UM232H
#
# This should also work with a UM232H-B, but that has not been tested.
# Note that UM232H and UM232H-B are 3.3V only.
#
interface ftdi
#ftdi_device_desc "UM232H"
ftdi_vid_pid 0x0403 0x6014
##ftdi_layout_init 0xfff8 0xfffb
##ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100
##ftdi_layout_signal nSRST -data 0x0200 -oe 0x0200
# interface 1 is the uart
ftdi_channel 0
# just TCK TDI TDO TMS, no reset
ftdi_layout_init 0x0008 0x000b
#ftdi_layout_init 0x0c08 0x0f1b
reset_config none
, ftdi_device_desc, 99-platformio-udev.rules.
libhidapi-hidraw0:
sudo apt-get install -y libhidapi-hidraw0
:
JTAG |
CJMCU FT232H |
Sipeed Longan Nano |
TDO |
AD2 |
JTDO |
TDI |
AD1 |
JTDI |
TCK |
AD0 |
JTCK |
TMS |
AD3 |
JTMS |
|
+3.3V |
3V3 |
|
GND |
GND |
RV-Debugger-Lite + Sipeed Longan Nano
, RV-Debugger-Lite 200 .
platformio.ini:
[env:sipeed-longan-nano]
platform = gd32v
framework = gd32vf103-sdk
board = sipeed-longan-nano
monitor_speed = 115200
debug_tool = sipeed-rv-debugger
upload_protocol = sipeed-rv-debugger
Sipeed RV-Debugger. , , , 1000 . :
/home/<username>/.platformio/packages/tool-openocd-gd32v/share/openocd/scripts/interface/ftdi/sipeed-rv-debugger.cfg
interface ftdi
##ftdi_device_desc "Dual RS232"
ftdi_vid_pid 0x0403 0x6010
#autoexit true
#interface cmsis-dap
transport select jtag
ftdi_layout_init 0x0008 0x001b
ftdi_layout_signal nSRST -oe 0x0020 -data 0x0020
ftdi_device_desc, : RV-Debugger FT2232D, RV-Debugger-Lite FT2232C, CH552T. VID/PID .
:
JTAG |
RV-Debugger-Lite |
Sipeed Longan Nano |
TDO |
TDO |
JTDO |
TDI |
TDI |
JTDI |
TCK |
TCK |
JTCK |
TMS |
TMS |
JTMS |
|
3V3 |
3V3 |
|
GND |
GND |
, . , .
PIO (platformio) JTAG FT232H ESP32