*** [uploadfs] Error 1

I am born to get into trouble… this project actually has run, but then my USB-keyboard stopped working. I installed another and WOOPS - suddenly things changed. I am pretty sure it has nothing to do with this matter, but for the record.
My symptom/prereq’s:

  1. Zadig was run and port is operational
  2. Randomnerds project 1.2 “Hello” compiles and runs of the book (no SPIFFS)
  3. Randomnerds project 2.5 “Build a WEB-server…” compiles OK - building using the PIO “Build Filesystem Image”:
    Building in release mode
    Building SPIFFS image from ‘data’ directory to .pio\build\esp32dev\spiffs.bin
    /favicon.png
    /index.html
    /script.js
    /style.css
    ===================== [SUCCESS] Took 1.10 seconds =====================

However here the problems start: I cannot upload (again using the pio menu Upload Filesystem Image) - the port is OK - so I guess it’s the file I have to locate or what ???

|-- <ESP Async WebServer> 1.2.3
|   |-- <AsyncTCP> 1.1.1
|   |-- <FS> 1.0
|   |-- <WiFi> 1.0
|-- <SPIFFS> 1.0
|   |-- <FS> 1.0
|-- <Arduino_JSON> 0.1.0
|-- <AsyncTCP> 1.1.1
|-- <WiFi> 1.0
Building in release mode
Building SPIFFS image from 'data' directory to .pio\build\esp32dev\spiffs.bin
/favicon.png
/index.html
/script.js
/style.css
Looking for upload port...
Use manually specified: 71
Uploading .pio\build\esp32dev\spiffs.bin
esptool.py v3.1
Serial port 71
Traceback (most recent call last):
  File "E:\ESP\ESP_IDF\packages\tool-esptoolpy\esptool.py", line 4582, in <module>
    _main()
  File "E:\ESP\ESP_IDF\packages\tool-esptoolpy\esptool.py", line 4575, in _main
    main()
  File "E:\ESP\ESP_IDF\packages\tool-esptoolpy\esptool.py", line 4074, in main
    esp = esp or get_default_connected_device(ser_list, port=args.port, 
connect_attempts=args.connect_attempts,
  File "E:\ESP\ESP_IDF\packages\tool-esptoolpy\esptool.py", line 120, in get_default_connected_device
    _esp = chip_class(each_port, initial_baud, trace)
  File "E:\ESP\ESP_IDF\packages\tool-esptoolpy\esptool.py", line 313, in __init__
    self._port = serial.serial_for_url(port)
  File "e:\esp\esp_idf\penv\lib\site-packages\serial\__init__.py", line 
90, in serial_for_url
    instance.open()
  File "e:\esp\esp_idf\penv\lib\site-packages\serial\serialwin32.py", line 64, in open
    raise SerialException("could not open port {!r}: {!r}".format(self.portstr, ctypes.WinError()))
serial.serialutil.SerialException: could not open port '71': FileNotFoundError(2, 'Den angivne fil blev ikke fundet.', None, 2)
*** [uploadfs] Error 1
====================== [FAILED] Took 1.27 seconds ======================The terminal process "E:\ESP\ESP_IDF\penv\Scripts\platformio.exe 'run', '--target', 'uploadfs', '--environment', 'esp32dev'" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.

> Executing task in folder 2_5_Multiple_Outputs_WebSocket: E:\ESP\ESP_IDF\penv\Scripts\platformio.exe run --target uploadfs --environment esp32dev <

This can’t be right. Serial port “71”?

On Windows, all serial ports start witht COM followed by a number. And then 71 seems incredibly high.

What does the Windows device manager say about your COM ports?

grafik

You need to set e.g. upload_port = COM10 accordingly, or better, delete it alltogether from your platformio.ini so that PlatformIO can do autodetection.

No the COM-port is correct. It originates from FTDI virtual comports from looong time ago when I used the FDTI comport chip - think it was called Max232 or some thing like that. Zadig installs correctly.
I have tried both to use autodection and manual entered in the platformIO.ini
image

May I add that this problem does not exist when I run the “Hello” without SPIFFS…
on this comport 71… I previously had problems with my path - I am running the project on my E:-drive.

WOW !! - new result - just tried to compile and upload with autodetection again
AND this time it actually did upload (but off cause with errors - but other symptoms… that’s another matter).
BUT the luck did not last - I’m back to the original error.
I am running ComPort71 via a Logiclink USB-hub and have now changed to the direct USB-port on front of my PC. RanZadig successfully and now have this port 23:
image
It does not change the result - still the same problem.
You may be right - I’ll move to a labtop to see if this helps…

I have build new HW - just in case the flash in ESP32 was defective - it was not. Same problem - I have removed wrong conclusions.
However this evening the symptoms changed to this:
Error: couldn’t open E:/ESP/ESP32_Projects/2_5_Multiple_Outputs_WebSocket/.pio/build/esp32dev/partitions.bin
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure ‘program_esp’
in procedure ‘program_error’ called at file “E:/ESP/ESP_IDF/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg”, line 157
at file “embedded:startup.tcl”, line 449
*** [uploadfs] Error 1

I cannot locate the “.pio/build/esp32dev/partitions.bin”
or this one -they do not exist on my machine:
.pio\build\esp32dev\spiffs.bin
Could this be a clue? Maybee a problem with setup?

Can you post the minimal project files which reproduce the problem?

OK - I have provided a link
https://oz7fox.dk/wp-content/uploads/Steen.zip
Please have a look at the video inside the Zip-file - I think it is the easiest way. Let the video finish - it stops - and proceeds…
(I will remove/clean up the file in a few days - I have just borrowed the memory for a while)
OK - two days later: AHAA… You may be right Maximilan!! It could very well be a ComPort problem - my installation on both my machines has FTDI virtual ComPort drivers installed. The problem is on both machines. However I have found a circumvention - it seems like when I force a new recompilation via debugging mode and a new upload file system image - then it works (most of the times). I still have to disconnect the USB port, but not as often.
I was guided on the track when I did a flash erase via ESPTOOL.PY ERASE_FLASH - detecting chip type - unsupported detection protocol.

Found 2 serial ports
Serial port COM71
Connecting…
Detecting chip type… Unsupported detection protocol, switching and trying again…
Connecting…
Detecting chip type… ESP32
Chip is ESP32-D0WD-V3 (revision 3)
*WOW ---- This is important **
I have found a small utility “usbdeview” that marks the “Dual RS232-HS” as unsafe to unplug - see this description:
** Safe To Unplug: Specifies whether it’s safe to unplug the device from the USB plug without disconnecting it first. If the value of this column is false, and you want to unplug this device, you must first disconnect this device by using the ‘Disconnect Selected Devices’ option (F9) of USBDeview utility, or by using the ‘Unplug or Eject Hardware’ utility of Windows operating system.

Even later - NOT SOLVED - did not work. New information - better error message:
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: Failed to get flash maps (4294967290)!
Warn : Failed to get flash mappings (-4)!
Error: Failed to get flash maps (4294967290)!
Warn : Failed to get flash mappings (-4)!
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **
** Programming Started **
Warn : Haven’t made progress in mpsse_flush() for 2018ms.
Error: ftdi device did not accept all data: 0, tried 13680
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_IO
Error: error while flushing MPSSE queue: -4
Warn : esp32.cpu0: Failed writing 512 bytes at address 0x40091a00
Error: Failed to write stub section!
Error: libusb_handle_events() failed with LIBUSB_ERROR_IO
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_IO
Error: error while flushing MPSSE queue: -4
Error: Failed to run flasher stub (-4)!
Error: error writing to flash at address 0x00000000 at offset 0x00008000
embedded:startup.tcl:449: Error: ** Programming Failed **
in procedure ‘program_esp’
in procedure ‘program_error’ called at file “E:/ESP/ESP_IDF/packages/tool-openocd-esp32/share/openocd/scripts/target/esp_common.cfg”, line 157
at file “embedded:startup.tcl”, line 449
Error: libusb_handle_events() failed with LIBUSB_ERROR_IO
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_IO
Error: error while flushing MPSSE queue: -4
Error: Failed to clear OCDDCR_ENABLEOCD!
Error: libusb_handle_events() failed with LIBUSB_ERROR_IO
Error: unable to purge ftdi rx buffers: LIBUSB_ERROR_IO
Error: error while flushing MPSSE queue: -4
Error: Failed to clear OCDDCR_ENABLEOCD!
*** [uploadfs] Error 1

When I look at the LED’s on the ESPprog they use to blink during programming - they don’t. No upload takes place…
It all points to USB-problems - I really need some help here… I don’t understand how to get on :frowning:

OK - another try with the upload - ComPort problem.
Do you know Hercules? It is a very handy communication utlity - which amongst others have serial communication. I restarted my PC, changed Comport and tried to open the ComPort (this time ComPort76) - nope could not open. I had PlatformIO open - and then shutdown PlatformIO - and tried to open the serial ComPort again in Hercules - and voila it could access the ComPort. Image enclosed
Does PlatformIO have a problem - am I doing something wrong?
image

Restarted PlatformIO and tried to upload. However no upload took place - nothing happens.
The real reason is perhaps here:
With a better headline and I close this one.
Have a look in this one:

ESP32 & could not open port ‘COM5’: PermissionError(13, ‘Access is denied.’, None, 5)