VS Arduino
Visual Micro >> General Board >> ESP32 Upload Error
https://www.visualmicro.com/forums/YaBB.pl?num=1653143039

Message started by StockBrick on May 21st, 2022 at 2:23pm

Title: ESP32 Upload Error
Post by StockBrick on May 21st, 2022 at 2:23pm
I have loaded the correct driver for the ESP32 and I can sometimes flash to the ESP32 but more often than not it fails with the following message "A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header". Any ideas what might be causing this. Thanks.

Title: Re: ESP32 Upload Error
Post by Acuario on May 22nd, 2022 at 9:32am
Sounds like a serial comms failure to me.
Are you using an ESP32 module with a USB connection cable?
Try reducing the upload speed (vMicro Upload speed) to something lower and try that.

What module/version of ESP32 are you using?

Title: Re: ESP32 Upload Error
Post by Simon@Visual Micro on May 23rd, 2022 at 9:48am
Can you also confirm which version of the CP2104 driver is installed from Device Manager?

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 2nd, 2022 at 3:04pm
Yes, using USB cable.
SparkFun Thing Plus - ESP32 WROOM
Upload speed:115200 I think this is the lowest setting in VM.
CP2104 driver: 11.1.0.53

Upload is failing every time today with:
esptool.py v3.1
Serial port COM8
Connecting........_____....._____....._____....._____....._____....._____....._____
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

I thought I had solved this last week after I changed Remote Transport to Bridge in project properties and it worked but it failed again today.

Serial output continues to work fine for app previously uploaded to ESP32.

Thanks.

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Jun 2nd, 2022 at 6:26pm
You need to use the driver marked for windows, not for windows universal. It is misleading on their page, the windows version is 6.7.6

use this link and click downloads

https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 3rd, 2022 at 9:09pm
I changed the driver to Windows version 6.7.6 but am still getting same error. Any ideas?

I’m confused about which is the correct driver. Sparkfun say that it should be a version at or above 10.1.3.2130 and their link sends you to the Windows Universal Version.

https://learn.sparkfun.com/tutorials/esp32-thing-plus-hookup-guide?_ga=2.233248921.609440675.1654157601-2131318877.1653256134

Thanks

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Jun 3rd, 2022 at 9:21pm
Thanks, we will review. Historically the CP210 10x driver for windows universal did not work with the std C# SerialPort commands. It got the baud rate wrong but because of the term "windows universal" everyone thinks it will work with normal windows. It might be that the 11x version of the CP210 driver fixes the issues, we will review.

It might also be unrelated therefore please follow the guide in yellow above so that we can see your build settings and verbose output.

Thanks

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 4th, 2022 at 3:09pm
Thanks. I have emailed you the output file when using driver v6.7.6.

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Jun 4th, 2022 at 6:26pm
Looks like your Visual Micro version is running a version from June last year?

Please update then submit output again if an issue.

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 5th, 2022 at 2:53pm
Thanks. I've updated VM to the latest version but still have the same issue. I'll email the output file. Output is using 11.1.0.53 Universal Windows driver but can swap back again 6.7.6 again if you need the output from that.

It's very odd. Got it to upload once yesterday using previous version of VM and driver 11.1.0.53 but when I repeated the upload it failed. I'll attached the upload output for that too.

Many thanks

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 10th, 2022 at 4:54pm
@Tim@Visual Micro Did you get a chance to review this error your end? Thanks

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Jun 11th, 2022 at 12:56pm
Sorry for the delay. Simon from vm will review first thing next week.

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 11th, 2022 at 1:09pm
No problem. Thanks.

Title: Re: ESP32 Upload Error
Post by Simon@Visual Micro on Jun 13th, 2022 at 3:09pm
Can you confirm if this works normally in the Arduino IDE, or whether this suffers the same issue?


Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 13th, 2022 at 4:06pm
Yes, same issue with Arduino IDE. Thanks.

Title: Re: ESP32 Upload Error
Post by Simon@Visual Micro on Jun 13th, 2022 at 5:09pm
Thanks for confirming. This means it is not an issue with Visual Micro directly, and we have been unable to replicate this on similar ESP32 boards on our side to investigate further.

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 13th, 2022 at 6:22pm
Thanks for looking at this. Do the settings look right from the log? It would be useful to know what driver you are running and do you have this specific Sparkfun board?

Title: Re: ESP32 Upload Error
Post by Simon@Visual Micro on Jun 14th, 2022 at 9:35am
From what we can see the settings look right, the upload process is handed over to the esptool.exe, so the upload can also be run from the command line to remove Visual Micro / Arduino IDE from the equation completely (this is seen in the output after enabling vMicro > Uploader > Verbose, and performing an upload in vMicro).

We do not have the specific Sparkfun board, however our ESP32 Dev Module has an ESP32 chip, and the same CP210x port.

Currently we are running the 11.1.0.53 driver, but found no issues with 10.1.10.103, or 6.7.6.2130 either.

As it has worked correctly for you a couple of times, have you tried the below options to troubleshoot?
a) Changing the USB lead
b) Changing the port it is connected to on your PC (ideally not through an external USB hub)
c) Remove all external connections from the board
d) Upload a very simple sketch (e.g blink)

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 25th, 2022 at 9:54pm
Thanks. I tried those things and it still did not work. Solution was to press button 0 on Sparkfun ESP32 when connecting as described in this post on their forum. https://forum.sparkfun.com/viewtopic.php?f=97&t=49164

Title: Re: ESP32 Upload Error
Post by Simon@Visual Micro on Jun 27th, 2022 at 10:50am
Thanks for the update and solution clarification on this aspect.

It is very confusing their guide says the auto reset should work, when this solution shows it clearly doesn't. They are working on improving the new esp32 board cores, it might be one to report on their github site.

Title: Re: ESP32 Upload Error
Post by StockBrick on Jun 27th, 2022 at 9:40pm
Yes, confusing. I’ll report on Expressif Github site as you suggest. I will also see if I can encourage Sparkfun to mention it in their guide. Thanks for your interest.

Title: Re: ESP32 Upload Error
Post by Sylvain on Jul 24th, 2022 at 4:27pm
Hi,
     I have almost the same problem,  With wemos esp32 the upload work, but with lolin esp32 upload fail, if I place a 2.2uf cap between GND and EN pin it's work, look like there is a timing problem to put the esp in bootmode. 

     Is it possible to modify the timing of the RTS and DTR pin?

Thanks
Sylvain Bissonnette

Title: Re: ESP32 Upload Error
Post by Simon@Visual Micro on Jul 28th, 2022 at 2:14pm
We have added an additional board.txt property to allow a configurable pause before the upload begins (example is 3s):
[code]upload.pause_before_ms=3000[/code]

This is available in the latest version (22.06.11.05) which is available for download from the top of the below board:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES

If this does not help, can you enable the below options:
  1. vMicro > Compiler > Verbose
  2. vMicro > Compiler > Show Build Properties
  3. vMicro > Uploader > Verbose


And perform the Build and Upload, and send us the entire contents of the Output > Micro Build window so we can replicate the setup exactly.

Title: Re: ESP32 Upload Error
Post by Sylvain on Jul 30th, 2022 at 2:46pm
I will try to remove the cap and add delay this week and keep you inform

Thanks
Sylvain Bissonnette

Title: Re: ESP32 Upload Error
Post by StockBrick on Jul 31st, 2022 at 12:41pm
Thanks @Simon@Visual Micro. I'm not clear on how to implement this. Is it a case of adding Local Board.txt to the project and adding the code upload.pause_before_ms=3000 as an override?

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Jul 31st, 2022 at 2:38pm
yes that is right

Title: Re: ESP32 Upload Error
Post by StockBrick on Jul 31st, 2022 at 3:00pm
With no "#" in front?

[code]# ESP32_BT_LSM9DS1_GPS_ESPMaster_BadElf_V02 build property overrides
upload.pause_before_ms=3000[/code]

Title: Re: ESP32 Upload Error
Post by StockBrick on Jul 31st, 2022 at 5:53pm
I'm still getting the error:
A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

I'll send output file via email.

Thanks

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Jul 31st, 2022 at 8:40pm
Ah I forgot that Visual Micro make the serial connection for the upload.

You might need to contact the author of the tool chain. You should also say what you have put in the board.txt in case it is causing non-standard upload.

This is the upload command. Please try it from a cmd prompt. You can see that it uses the esptool.exe which is part of the tool chain.

[code]C:\Users\Stephen\AppData\Local\arduino15\packages\esp32\tools\esptool_py\3.1.0\esptool.exe --chip esp32 --port "COM8" --baud 115200 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 16MB 0xe000 "C:\Users\Stephen\AppData\Local\arduino15\packages\esp32\hardware\esp32\2.0.2/tools/partitions/boot_app0.bin" 0x1000 "C:\Users\Stephen\AppData\Local\Temp\VMBuilds\ESP32_~1\ESP32_~1\Release/ESP32_BT_LSM9DS1_GPS.ino.bootloader.bin" 0x10000 "C:\Users\Stephen\AppData\Local\Temp\VMBuilds\ESP32_~1\ESP32_~1\Release/ESP32_BT_LSM9DS1_GPS.ino.bin" 0x8000 "C:\Users\Stephen\AppData\Local\Temp\VMBuilds\ESP32_~1\ESP32_~1\Release/ESP32_BT_LSM9DS1_GPS.ino.partitions.bin"
[/code]

Title: Re: ESP32 Upload Error
Post by Tim@Visual Micro on Aug 6th, 2022 at 7:26pm
Off-Topic replies have been moved to this Topic.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.