En este tutorial, me gustaría hablar sobre cómo usar los depuradores JTAG ultra-económicos CJMCU FT232H y RV-Debugger-Lite en PlatformIO para flashear y depurar dispositivos en plataformas ESP32 y GD32. No encontré una instrucción completa en Internet, y durante el proceso de configuración encontré muchos problemas, por lo que este tutorial aparece aquí para su conveniencia. Haré una reserva de inmediato de que la configuración está escrita para Linux, pero para Windows no hay una diferencia fundamental excepto bailar con Zadig.
CJMCU FT232H + ESR32 Rev1 también conocido como ESP32Dev
Me refiero a este depurador basado en el chip FT232H:
Y aquí está esta placa basada en ESP-WROOM-32:
Configuración de Platformio.ini:
[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
monitor_speed = 115200
upload_speed = 921600
debug_tool = minimodule
upload_protocol = minimodule
Aquí tenemos un CJMCU FT232H por 700 rublos que pretenderá ser un depurador FT2232H MINI MODULE para 4500. Para hacer esto, debe realizar los siguientes cambios en el archivo (las líneas que comenté comienzan con ##):
/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