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) Serial Output stops but program runs (Read 3970 times)
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Serial Output stops but program runs
Feb 22nd, 2018 at 3:38am
Print Post  
I have an Arduino program which displays data on an OLED and writes it to Serial Output.  Problem is that after a few prints to SO it stops doing that.  My program is still running because the OLED is getting regular updates.  It's just not writing to SO.  Angry
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial Output stops but program runs
Reply #1 - Feb 22nd, 2018 at 11:26pm
Print Post  
Is the tool bar (configuration) set to release?

which board and tool chain/arduino version?
« Last Edit: Feb 22nd, 2018 at 11:26pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial Output stops but program runs
Reply #2 - Feb 23rd, 2018 at 12:19am
Print Post  
Sorry, Tim, bit I do not understand either question.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial Output stops but program runs
Reply #3 - Feb 23rd, 2018 at 1:05am
Print Post  
Does the tool bar show "Debug" or "Release"
  
Back to top
WWW  
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial Output stops but program runs
Reply #4 - Feb 23rd, 2018 at 1:08am
Print Post  
It shows 'Debug'.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial Output stops but program runs
Reply #5 - Feb 23rd, 2018 at 1:27am
Print Post  
Please switch to Release and upload again.

In "Debug" mode you need to ensure println() is used in code (or "\r\n") at some point to cause the monitor to draw the inbound serial data.

In "Debug" mode the default speed can be 115200 but sometimes visual micro can auto detect any change you have made to the speed in your serial.begin(). 


In Release mode you can more easily change speed the monitor is using (the speed is shown at the bottom of the monitor window).

« Last Edit: Feb 23rd, 2018 at 1:29am by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial Output stops but program runs
Reply #6 - Feb 23rd, 2018 at 7:44am
Print Post  
Tim@Visual Micro wrote on Feb 23rd, 2018 at 1:27am:
In "Debug" mode you need to ensure println() is used in code (or "\r\n") at some point to cause the monitor to draw the inbound serial data.
 

Changing  to Release stopped Serial Monitor stalling but I don't understand the println() bit.  The code is fill of println statements.

NB: The code is in Arduino so it is an INO file.
  

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


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial Output stops but program runs
Reply #7 - Feb 23rd, 2018 at 12:54pm
Print Post  
Okay then I expect the arduino serial buffer filled up too quickly. The size of the buffer changes for each chip and is quite small.

The debugger sends extra serial code (small packets) so that might push you over the limit especially if you have many serial prints.

It's actually better to use debugger messages than litter the code with serial print statements. The debugger messages do not store large strings on the arduino so uses less memory and less to transmit

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


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial Output stops but program runs
Reply #8 - Feb 23rd, 2018 at 10:26pm
Print Post  
Tim@Visual Micro wrote on Feb 23rd, 2018 at 12:54pm:
Okay then I expect the arduino serial buffer filled up too quickly.  ...
The debugger sends extra serial code (small packets) so that might push you over the limit especially if you have many serial prints.


There is a fair amount of 'debugging' output during the 'handshake' phase of program boot.  That all works just fine - no overload there.  Smiley

The code which is using Serial Output when SO stalls is in two functions: writeToMonitor() at line 758 and writeToExcel at line 789.  It is minimal and only gets called into action every ten seconds (it would be every fifteen minutes in a real remote station).  The output to the OLED uses u8g2lib and shouldn't interfere with SO.  Undecided

I have attached the sister program.  The start sequence is PTX first, then PRX.  You should see the handshake and the PTX SO should show a couple of nans every ten seconds.  Of course, without the RC hardware and the sensor PRX won't show any activity.

I can send you the circuit diagrams if you're that enthusiastic  Cheesy
  

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


Posts: 12070
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Serial Output stops but program runs
Reply #9 - Feb 23rd, 2018 at 11:08pm
Print Post  
Okay so release mode does not stall.

The debugger can be assigned a different port or pins if you are reading serial or have conflicts with the debugger. Normally the debugger attempts to share the usb but if it's being used extensively by the code it ca be too much
  
Back to top
WWW  
IP Logged
 
hauwarea
Junior Member
**
Offline


Posts: 34
Location: Perth Western Australia
Joined: Apr 9th, 2017
Re: Serial Output stops but program runs
Reply #10 - Feb 23rd, 2018 at 11:25pm
Print Post  
Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint