Usando depuradores JTAG de orçamento em PlatformIO

Neste tutorial, gostaria de falar sobre como usar os depuradores JTAG ultra-econômicos CJMCU FT232H e RV-Debugger-Lite no PlatformIO para atualizar e depurar dispositivos nas plataformas ESP32 e GD32. Não encontrei uma instrução completa na Internet, e durante o processo de configuração tive muitos problemas, por isso este tutorial aparece aqui para sua comodidade. Farei uma reserva imediatamente que a configuração é escrita para Linux, mas para Windows não há diferença fundamental exceto para dançar com Zadig.





CJMCU FT232H + ESR32 Rev1 também conhecido como ESP32Dev

Refiro-me a este depurador baseado no chip FT232H:





E aqui está esta placa baseada em ESP-WROOM-32:





Configurações de Platformio.ini:





[env:esp32dev]
platform = espressif32
framework = arduino
board = esp32dev
monitor_speed = 115200
upload_speed = 921600
debug_tool = minimodule
upload_protocol = minimodule
      
      



Aqui temos um CJMCU FT232H para 700 rublos que fingirá ser um depurador FT2232H MINI MODULE para 4500. Para fazer isso, você precisa fazer as seguintes alterações no arquivo (as linhas que comentei começam com ##):





/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





ESP-32





Debugging Longan Nano








All Articles