ESP32 Remote Debugging: Difference between revisions

From JoBaPedia
Jump to navigation Jump to search
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 4: Line 4:


* ESP32 (no USB2Serial adapter or separate power supply needed)
* ESP32 (no USB2Serial adapter or separate power supply needed)
* ESP-Prog Adapter 12,80 | ESP-Prog JTAG Debug & Program Downloader (12,80€ + 3,24€ shipping) https://s.click.aliexpress.com/e/BejpuNBE
* ESP-Prog JTAG Debug & Program Downloader (12,80€ + 3,24€ shipping) https://s.click.aliexpress.com/e/BejpuNBE
* Dupont cables Female-(whatever you ESP32 needs) or similar (5-10)
* Dupont cables female-(whatever your ESP32 needs) or similar (5-10)
** 1 for ground
** 1 for ground
** 4 for JTAG (TDI, TDO, TCK and TMS)
** 4 for JTAG (TDI, TDO, TCK and TMS)
Line 41: Line 41:


== Quirks ==
== Quirks ==
* On Windows you need some USB driver assignment tool and drivers (not tested)
* On Windows you need some USB driver assignment tool and drivers (not tested, see https://youtu.be/psMqilqlrRQ)
* Newer linux distros might not preinstall the old libcurses5 library. I had to install it:
* Newer linux distros might not preinstall the old libcurses5 library. On opensuse 15.1 I had to install it:
  sudo zypper install libncurses5
  sudo zypper install libncurses5
* Remember: pin RX goes to TX and TX to RX crossed, but TDI and TDO are not crossed like the other pins
* Remember: pin RX goes to TX and TX to RX crossed, but TDI and TDO are not crossed like the other pins

Latest revision as of 20:15, 22 August 2019

ESP32 Remote Debugging

Hardware

  • ESP32 (no USB2Serial adapter or separate power supply needed)
  • ESP-Prog JTAG Debug & Program Downloader (12,80€ + 3,24€ shipping) https://s.click.aliexpress.com/e/BejpuNBE
  • Dupont cables female-(whatever your ESP32 needs) or similar (5-10)
    • 1 for ground
    • 4 for JTAG (TDI, TDO, TCK and TMS)
    • 1 optional for Power if ESP32 should be powered via the ESP-Prog
    • 1 optional for serial RX if you want to receive boot messages from the ESP32 via the ESP-Prog
    • 1 optional for serial TX if you want to send data to the ESP32 via the ESP-Prog
    • 2 optional for Reset and IO0 if you want to automatically control boot mode for flashing
  • USB cable (ESP-Prog micro port to whatever fits into your computer)

Software

Minimalist

I did not test this

IDE

  • VS Code
  • PlatformIO for VS Code

PlatformIO Project Config

add this to your platformio.ini:

debug_tool = esp-prog
debug_init_break = tbreak setup
monitor_port = {yourProgPortName}
monitor_speed = 115200
;left here for experiments...
;upload_port = {yourProgPortName}
;upload_protocol = esp-prog

{yourProgPortName} could be /dev/ttyUSB2 or COM5 or similar (the lower of the 2 ports Esp-Prog exposes)

Quirks

  • On Windows you need some USB driver assignment tool and drivers (not tested, see https://youtu.be/psMqilqlrRQ)
  • Newer linux distros might not preinstall the old libcurses5 library. On opensuse 15.1 I had to install it:
sudo zypper install libncurses5
  • Remember: pin RX goes to TX and TX to RX crossed, but TDI and TDO are not crossed like the other pins

Recommended

If you want Linux to assign fixed port names for your adapter, create a file /etc/udev/rules.d/98-Dual-RS232-HS.rules

SUBSYSTEMS=="usb", ATTRS{interface}=="Dual RS232-HS", KERNELS=="*:1.0", MODE:="0660", GROUP:="dialout", SYMLINK+="ttyUSB_jtag"
SUBSYSTEMS=="usb", ATTRS{interface}=="Dual RS232-HS", KERNELS=="*:1.1", MODE:="0660", GROUP:="dialout", SYMLINK+="ttyUSB_prog"

Then execute

sudo udevadm control --reload-rules
sudo udevadm trigger

You will see /dev/ttyUSB_prog and /dev/ttyUSB_jtag devices with full access for group dialout now. The *_jtag device is not really needed, because the driver finds it anyways (at least if you only have one attached at a time, like me).

Go!

  • Attach your ESP32 to ESP-Prog and that via USB to your computer.
  • Open your project in VS Code and press Ctr-Shift-D.

Project should build, upload, start and break at the setup() routine.