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) ESP32 serial debug - output stops, but works OK in Arduino IDE (Read 7052 times)
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
ESP32 serial debug - output stops, but works OK in Arduino IDE
May 23rd, 2021 at 9:46am
Print Post  
I have just acquired an ESP32 module (Lilygo-T-Call-SIM800) and trying it with a simple HTTP example. Works fine in the Arduino IDE but in VM the program appears to load correctly but then the serial output halts (before the program runs).
I get this reported on the serial monitor:
Code
Select All
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4

Opening port
Port open

 


then nothing.
(Just to be sure, I went back to an old project with a UNO and get correct serial output with that in VM).
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #1 - May 24th, 2021 at 8:17am
Print Post  
Thanks for the report.   

So we can understand the environment, please attach the full output from the build with the Verbose and Show Build Properties enabled, as shown at the top of this page.

Just to note if Serial Debug is enabled, this may be automatically setting a breakpoint at the top of loop() where the execution will stop until you press continue in the IDE.
  
Back to top
 
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #2 - May 24th, 2021 at 8:36pm
Print Post  
Build file attached. There were no breakpoints. If I try to add one (in first line of Setup()) I get this message:
Quote:
User Experience : The serial debugger was delayed waiting for an incoming line of data.If the Serial.print() command is used between breakpoints, then ensure that a line termnator is sent using.println() or .print("\r\n").Optionally, use #if defined(VM_DEBUG)to add code that is only active when debugging. (if this is expected then switch this user experience message off in tools > options > visual micro > micro debug)

All my print commands are println(). So maybe the program is stopping somewhere in the Cstartup section?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #3 - May 27th, 2021 at 11:17am
Print Post  
Anybody?? I cannot make any programs* run under VM, they all work with the Arduino IDE. Using Lilygo-T-Call-SIM800. Build file attached to my previous message.
*even just an empty setup() and loop() with a single serial println().
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #4 - May 27th, 2021 at 11:28am
Print Post  
If you disable the Serial debugger, by changing to the Build Configuration: "Release " do you still have the same issue?
  
Back to top
 
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #5 - May 27th, 2021 at 2:38pm
Print Post  
Same result in release mode. But - discovery - if I remove all the serial commands, and just do this:
Code (C++)
Select All
void setup() {
pinMode(13, OUTPUT);
}

void loop() {
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
} 


then the program runs (and I can add working breakpoints). So a workaround will be to remove (or #define out somehow) all the 'normal' serial commands from the examples I'm trying, and just use VM's debugger.
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2145
Joined: Feb 13th, 2019
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #6 - May 27th, 2021 at 3:00pm
Print Post  
Understood, apologies I expected the Release mode to disable the serial debugger.

Depending on the complexity of your serial code, you can use your own Serial code at the same time as the Serial debugger on the same port, noting the information on the below page regarding String only data, Serial.Read() and baud rate alignment:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging.html#vmd7
  
Back to top
 
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #7 - May 27th, 2021 at 4:24pm
Print Post  
Hmmm. All the baud rates are the same, and I'm not using serial.read(). 
Code
Select All
void setup() {
  Serial.begin(115200);
}
void loop() {
  Serial.println("test");
} 


This fails to output anything, whether in debug or release mode. I could try OTA debugging, I suppose. I will need to see a stream of serial data from the device though, in real time, rather than just adding breakpoints.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #8 - May 27th, 2021 at 7:36pm
Print Post  
It's possible you have the wrong usb driver installed. The one marked for windows universal has a bug in it when the serial is accessed via C#. The one for windows 8 is actually also for windows 10. Which usb driver date/ver are you using?

We have reported it. Arduino IDE uses java so is immune fro this issue.

See the top of this page for more info https://www.visualmicro.com/page/How-to-install-Esp32-for-Arduino-and-Visual-Mic...

« Last Edit: May 27th, 2021 at 7:38pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #9 - May 27th, 2021 at 9:33pm
Print Post  
So, I changed USB driver to ver 6 (it was ver 10) but no effect.
Then I installed everything fresh on my laptop. The USB driver here is also ver 6 (though I didn't have to change it). Same board manager files (espressif/arduino-esp32) and the serial output worked - after a fashion - once.  Next run , I get the same result as on the desktop, i.e. a simple LED blink program does not run if serial.begin() is used in setup().
So how/why did it run just once? Still runs fine in Arduino IDE!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #10 - May 27th, 2021 at 9:39pm
Print Post  
Can we see another build output so the settings you have are clear. It should work same as the Uno without a hitch. There are a lot of ESP32 users of Visual Micro so it will be interesting to see the settings now.

Please give build output when release is selected and optimization has not been disabled.

If you want to save some time the verbose output from same sketch in the Arduino IDE will allow us to compare the selected board settings.
« Last Edit: May 27th, 2021 at 9:41pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #11 - May 28th, 2021 at 7:34am
Print Post  
Ok, attached two new builds. The Arduino one doesn't seem very verbose though.
I'm away now until Tuesday so no rush!
Thanks
  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #12 - May 28th, 2021 at 4:55pm
Print Post  
Thanks. Arduino don't put the build properties in the verbose output but same can be decuded from the actual build commands.

Is it possible the DTR or RTS on the serial window have been enabled? Can you confirm they are off? For esp32 boards, they should automatucally be off unless switched on manually. They have different effect than for AVR and should be avoided for ESp32

Can you show screen shot of serial monitor please.
  
Back to top
WWW  
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #13 - May 31st, 2021 at 8:23pm
Print Post  
Screen shot attached. RTS and DTR both off (I also tried with them on!)
Today (after leaving everything switched off for nearly 4 days) I ran the programs again (on my desktop)  and they worked fine first time! A couple of times. Then they stopped as before. I also tried swapping to another ESP32 module (identical to the first) - same problem. And this one also works fine with the Arduino IDE.
So, the issue is definitely intermittent (both laptop and desktop work for a while than stop).
I note that a  new release is available - should I try that or will that cloud the issue?
  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #14 - May 31st, 2021 at 11:25pm
Print Post  
Thanks for the info. The Serial system hasn't changed for a long time and is very widely used. This type of problem would have been reported by others so we need to look at your outputs and see tool chain versions, board then replicate.

It might take a few days, sorry about that. Can you please give update as to if you still see the errors appear in the serial monitor or is it just that the serial stops?


  
Back to top
WWW  
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #15 - Jun 1st, 2021 at 9:58am
Print Post  
It's not just that the serial stops, the program doesn't run at all. (Current test program below).
  • When the problem occurs, restarting VS doesn't help. 
  • When the problem occurs, the serial output stops AND the LEDs stop flashing - so the program just isn't running.
  • When it has occurred, removing the Serial commands and reloading makes the LEDS flash again.
  • Restarting Windows makes everything work again (for a while).
  • Sometimes I get "VMDPR_" appearing in the output window, but I think that was only when there were no serial commands.
  • I can't make the serial output work at all on my laptop now; it did work once however.

Code
Select All
void setup() {
    Serial.begin(115200);
    pinMode(13, OUTPUT);
}

void loop() {
	Serial.println("led on");
	digitalWrite(13, HIGH);
	delay(1000);
	Serial.println("off");
	digitalWrite(13, LOW);
	delay(1000);
} 

  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #16 - Jun 1st, 2021 at 3:13pm
Print Post  
Thanks. The cpu is crashing, it is not related to serial. The build commands we are using are the same as the ones the Arduino IDE is using.

When the serial debugger is enabled there can sometimes be broken debug reporting packets. This is especially the case if the debugger "Auto reports" has been enabled. The broken report packets will appear as "VMDPR_" in the serial monitor but cause no issue. It however an indication that the board struggles with high rates of serial.

The only thing left to check is that the same code is being found during compile. To do this you need to click "Build>Clean Solution". This will zap the cache for the core so the next build will show the core being built. 

Please post a verbose output with debug Off after "cleaning the solution" and also post or email a zip with this file that is created during the build 

Code
Select All
\Release\esp-32-blink.cpp 



Thanks
« Last Edit: Jun 1st, 2021 at 3:14pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #17 - Jun 2nd, 2021 at 8:36pm
Print Post  
Here's the cpp file:
Code
Select All
#include <arduino.h>
#line 1 "C:\\Users\\quilk\\Documents\\Arduino\\esp-32-blink\\esp-32-blink.ino"
#line 1 "C:\\Users\\quilk\\Documents\\Arduino\\esp-32-blink\\esp-32-blink.ino"

//
//

#line 2 "C:\\Users\\quilk\\Documents\\Arduino\\esp-32-blink\\esp-32-blink.ino"
void setup() {

	Serial.begin(115200);
    pinMode(13, OUTPUT);
}

void loop() {
	Serial.println("led on");
	digitalWrite(13, HIGH);
	delay(1000);
	Serial.println("off");
	digitalWrite(13, LOW);
	delay(1000);
}
 


and the cleaned build file is attached. 
I've now also come across a different issue that shows in VM but not in Arduino, but I will investigate/post in the relevant section.
  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #18 - Jun 2nd, 2021 at 9:10pm
Print Post  
Thanks

Please try the .4 release if you get a mo. We will be doing some more testing later today but interested to know if this resolves.

https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
« Last Edit: Jun 3rd, 2021 at 12:08am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: ESP32 serial debug - output stops, but works OK in Arduino IDE
Reply #19 - Jun 3rd, 2021 at 4:04pm
Print Post  
Tim, I uploaded 2021.527.0 first, and that seems to have solved the problem, on both laptop and desktop - I can now run in debug mode on both  Smiley
Version before on desktop was 2021.106.1, on laptop I think it was 106.18.
Other issue with incorrect intellisense is still there, I will post separately about that.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint