Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Compile time and OTA issues with ESP-32-CAM (Read 1880 times)
Justin64
Newbies
*
Offline


Posts: 5
Joined: Feb 19th, 2019
Compile time and OTA issues with ESP-32-CAM
Oct 25th, 2024 at 9:06pm
Print Post  
Hi, I am trying out Visual Micro for ESP32-CAM, currently plugged in MB programmer, via USB on COM5 to my PC. I installed Visual Studio 2022 and Visual Micro version . My goal is to get OTA working.

However, I've got 2 major issues:
1) Compile time is very long, around 25-30 seconds, even if nothing has changed in the code. I enabled Verbose logs, and it seems most of the time is spent in "Deep search for libraries" and "Building core", but the rest is also pretty slow. By comparison, Arduino IDE compiles the same sketch in ~5 seconds. 
2) I attempted OTA example from here, and the initial compile and upload via COM5 works fine, Serial Monitor shows:

Port open
VMDPR_Booting
Ready
IP address: 192.168.1.242

...but trying to upload it via IP does not, it results in "Error Uploading: [WinError 10054] An existing connection was forcibly closed by the remote host".

I have installed Bonjourn service, Visual Micro is able to detect ESP32 IP as per the tutorial. Firewall ports are open, no antivirus running. I am not using boards.txt since I don't have the Pro version yet.

Attaching output from slow compile and failed OTA upload with time stamps, Show Build Properties and Verbose enabled. Also, below is a screenshot of my settings. Please note that Wifi SSID and password have been purposefully redacted from the output.txt  Smiley

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compile time and OTA issues with ESP-32-CAM
Reply #1 - Oct 25th, 2024 at 11:01pm
Print Post  
1)

The serial debugger is enabled.

I suggest you switch the tool bar to Release until you have a working OTA config. Your serial comnined with Visual Micro serial debugger adds complexity.

2)

Show an image of the list of serial ports/ip addresses and confirm if you have set a password and what it is? The password is different to the wifi password.

3)

switch on vMicro>Uploader>Verbose and provide the output again after upload attaempt

Thanks

  
Back to top
IP Logged
 
Justin64
Newbies
*
Offline


Posts: 5
Joined: Feb 19th, 2019
Re: Compile time and OTA issues with ESP-32-CAM
Reply #2 - Oct 26th, 2024 at 9:54am
Print Post  
Tim, thank you for a very fast reply.

1) I switched to Release, and I'm not sure if it helped, but it appears that with some compilations when output says "Using previously compiled variant" and "Using previous search results", it completes in several seconds, but other times (even though I didn't change the code) it starts searching again, and that takes a very long time. But last 10 compiles or so were the fast ones, so perhaps it just needed multiple attempts to finally realize it already has all the libraries  Grin

2) Image of the serial ports/ips:



Please note that the auto-discovered ip sometimes appears, sometimes don't. For example, if I restart VS, it does not appear. If I reboot ESP32, it doesn't appear either. But if I re-upload the code via COM5, then it appears most of the time, but not always. Not sure how to manually do a "refresh" for that auto-discovery.

As for password, you mean "ArduinoOTA.setPassword"? If so, then no, I did not set it, as I understand it is optional? Nevertheless, I tried enabling it (uncommenting that line), and upon upload start it does ask me to enter that password, but finally fails with the same error as before.

3) Ok, verbose enabled. I am attaching the output, and also the sketch I am trying to upload via COM5 and then via IP. SSID and password redacted, but otherwise no changes.
« Last Edit: Oct 26th, 2024 at 9:55am by Justin64 »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Compile time and OTA issues with ESP-32-CAM
Reply #3 - Oct 28th, 2024 at 12:05pm
Print Post  
2) OTA Upload Failure:
I believe the OTA Upload will always fail with the Partition Scheme you have selected, as there is no space left to put the next image for flashing.

Can you change the option on the boards' menu to "Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)", and then perform the upload via Serial (COM5) again.

This should then allow the OTA Upload to work.

IP Address Discovery
The discovery will take a little time (10s) after the board has rebooted, and connected to the WiFi to show.  We will retest this, but can see the MDNS discovery is automatically enabled for this sketch so it should be more consistent.
  
Back to top
IP Logged
 
Justin64
Newbies
*
Offline


Posts: 5
Joined: Feb 19th, 2019
Re: Compile time and OTA issues with ESP-32-CAM
Reply #4 - Oct 28th, 2024 at 3:32pm
Print Post  
Simon, thank you very much! What you suggested is kind of obvious, but I completely missed it  Roll Eyes

Another quick question: can OTA work with ESP32 in station mode? Meaning I wouldn't need a router, but the ESP would act as a router itself, so I can connect to it from my laptop and upload the code?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Compile time and OTA issues with ESP-32-CAM
Reply #5 - Oct 28th, 2024 at 4:44pm
Print Post  
I believe it will work in AP mode yes, the OTA only needs a connection to upload the code, once complete it resets and flashes the board.
  
Back to top
IP Logged
 
Justin64
Newbies
*
Offline


Posts: 5
Joined: Feb 19th, 2019
Re: Compile time and OTA issues with ESP-32-CAM
Reply #6 - Oct 28th, 2024 at 6:18pm
Print Post  
Thank you, I'll try that. Last question: in OTA upload mode, how do I use Serial.print to get debugging info out of my code during runtime? I get that as the name implies, Serial is meant to send messages over serial connection rather that WiFi, so is there anything I can use instead to get these messages to Output window or something else that is inside Visual Studio? I've google this, and most suggest hosting some webpage with ESP32 or other external applications to view data output during runtime, but I'd really like to stay inside VS for development.
  
Back to top
 
IP Logged
 
Acuario
Senior Member
****
Offline


Posts: 256
Location: Spain
Joined: Aug 28th, 2015
Re: Compile time and OTA issues with ESP-32-CAM
Reply #7 - Oct 28th, 2024 at 6:45pm
Print Post  
If you are still connected to the com port then simply open a serial monitor window when connected to that port. Then change to the IP address of the ESP and you can upload the code via OTA to the device. The serial monitor will remain open and will continue to receive data from the com port (your Serial.print lines).

It you want to debug using WiFi rather than a serial port then there is information about that on this site.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Compile time and OTA issues with ESP-32-CAM
Reply #8 - Nov 7th, 2024 at 2:22pm
Print Post  
Quote:
how do I use Serial.print to get debugging info out of my code during runtime?


The only integrated option currently is to use the Serial Debugger over WiFi, where you can then use the MicroDebug.SendUserMessage() to send messages back to the Serial Monitor window.
https://www.visualmicro.com/page/Over-The-Air-Debugging-in-Visual-Micro.aspx

If you want to have a separate Serial Monitor open which is not the upload Port/IP address, this can be done from the vMIcro > General > Monitor Alternative drop down.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint