How to monitor ESP32 serial in PlatformIO IDE when debugging using ESP-Prog?

hi folks! Great set of tools, thanks a million!

I’m using the debugger as described here Use the PlatformIO Debugger on the ESP32 Using an ESP-prog - Hackster.io with:

  • Ubuntu 18.04
  • PlatformIO 4.3.3 on VSCode
  • ESP IDF 4.0
  • Adafruit ESP32 Huzzah feather
  • ESP-Prog
  • Brian Lough’s JTAG breakout for the feather

Everything works really well :slight_smile: except I can’t figure out how to monitor serial output from within PlatformIO IDE. I have connected both the ESP-Prog USB and the ESP32 USB, and can monitor if I do it separately from the command line like this:

~/.platformio/penv/bin/platformio device monitor -b 115200

Is there a way I can capture the serial output in the IDE?

(And, if so, can I also use it to monitor straight after upload when not debugging, instead of having to separately open the serial monitor?)

Thanks! All the best
Hamish

Hi @hamishcunningham! I’m not sure I undestand what exactly you’re trying to achieve, the easiest way is to open serial monitor directly in the IDE:
Set monitor_speed = 115200 in your platformio.ini
and then just open serial monitor from the toolbar:
image

2 Likes

Thanks! I was getting

 Error: libusb_claim_interface() failed with LIBUSB_ERROR_BUSY

when trying to debug with the serial monitor open, but it seems if I wait until the debug session is running then I can open the monitor successfully :slight_smile:

That solves my problem, though I wonder if there is a way to automagically do monitoring as soon as the device is ready? (ESP IDF’s internal monitor provides this.)

Thanks again!

Which port do you use for monitoring from ESP-Prog or ESP32?

I have three available (below), and have used /dev/ttyUSB2 successfully from the IDE (though it was mapped to the USB/UART bridge at the time).

~/.platformio/penv/bin/platformio device list
/dev/ttyUSB2
------------
Hardware ID: USB VID:PID=0403:6010 LOCATION=1-3.1.2:1.1
Description: Dual RS232-HS

/dev/ttyUSB1
------------
Hardware ID: USB VID:PID=0403:6010 LOCATION=1-3.1.2:1.0
Description: Dual RS232-HS

/dev/ttyUSB0
------------
Hardware ID: USB VID:PID=10C4:EA60 SER=01C2EEDE LOCATION=1-3.1.1
Description: CP2104 USB to UART Bridge Controller

Since the board is also connected to the computer, maybe you can use /dev/ttyUSB0 as the serial port instead of ESP-Prog?

monitor_port = /dev/ttyUSB0
1 Like

That worked, thanks for your help!