Visual Studio Code pio upload and monitor both stopped working

Hey everyone,

I’ve been using Platformio for several years, mainly on Mac. A few months I transitioned from Atom to Visual Studio Code. Things have been going very well but just this morning upload and monitor with ESP32 stopped working completely on all projects.

My ini file:

[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
lib_deps =
	ArduinoJson@~5.13
	ayushsharma82/AsyncElegantOTA@^2.2.6
	https://github.com/me-no-dev/ESPAsyncWebServer.git
upload_port = /dev/cu.SLAB_USBtoUART
monitor_speed = 115200

Error Log in terminal when uploading or attempting monitor:

Traceback (most recent call last):
  File "/Users/traviselliott/.platformio/packages/tool-esptoolpy/esptool.py", line 34, in <module>
    esptool._main()
  File "/Users/traviselliott/.platformio/packages/tool-esptoolpy/esptool/__init__.py", line 1032, in _main
    main()
  File "/Users/traviselliott/.platformio/packages/tool-esptoolpy/esptool/__init__.py", line 674, in main
    esp = esp or get_default_connected_device(
  File "/Users/traviselliott/.platformio/packages/tool-esptoolpy/esptool/__init__.py", line 920, in get_default_connected_device
    _esp = chip_class(each_port, initial_baud, trace)
  File "/Users/traviselliott/.platformio/packages/tool-esptoolpy/esptool/loader.py", line 302, in __init__
    self._port = serial.serial_for_url(port)
  File "/Users/traviselliott/.platformio/penv/lib/python3.9/site-packages/serial/__init__.py", line 90, in serial_for_url
    instance.open()
  File "/Users/traviselliott/.platformio/penv/lib/python3.9/site-packages/serial/serialposix.py", line 332, in open
    self._reconfigure_port(force_update=True)
  File "/Users/traviselliott/.platformio/penv/lib/python3.9/site-packages/serial/serialposix.py", line 517, in _reconfigure_port
    termios.tcsetattr(
termios.error: (22, 'Invalid argument')
*** [upload] Error 1

Any thoughts on what might have broke overnight? It does appear there was an update to Visual Studio Code. Latest version shows 1.83.1

I’m dead in the water and unable to resolve.

Usually this indicates hardware failure. In combination with Mac that means:

  1. to try a different USB cable (source, source)
  2. to connect it to a USB 2 port (source) or USB 2 Hub.

You’re right. I actually got a hold of a bad ESP32. It’s always the simplest thing I guess. Problem was it messed up the USB port on my MAC so it looked like all the modules were bad, but it was just one bad module that was messing up the port requiring reboot.

Thank you