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) Arduino Leonardo doesn't boot - without USB/Serialport connection (Read 11835 times)
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Arduino Leonardo doesn't boot - without USB/Serialport connection
Nov 1st, 2013 at 11:08am
Print Post  
Hello,

Lucky to have set some Debug-Tracepoints, I let work my Arduino Leonardo without USB/Port connection.
But - at some point I had to reboot the arduino - still powered by an external powersupply.
At this point I realized, the the Arduino doesn't boot (it did not enter the Setup()!  ) till I reconnected the USB/Port to Atmel Studio.

My Goal was, to have the Arduino working with some tracepoints enabled, so I can reconnect at a later time to see how it works...
But it seams, that this would cause some problems in case of a reboot.

Is it by designe - spezific to Leonardo?

Thank You
Thomas

« Last Edit: Nov 1st, 2013 at 11:41am by thjakob »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #1 - Nov 1st, 2013 at 1:02pm
Print Post  
Hello,

We expect the Leonardo to run without the usb connected. We need to run some tests to look at this report. 

In the meantime if you want the Leonardo to run without debug then you can compile without debugging. Which ide are you using?

Thanks

  
Back to top
IP Logged
 
Dennis Mabrey
Junior Member
**
Offline


Posts: 19
Location: Branchburg, NJ
Joined: Oct 22nd, 2013
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #2 - Nov 1st, 2013 at 1:10pm
Print Post  
Sounds like someone somewhere has the line  while(!Serial); in their code.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #3 - Nov 1st, 2013 at 1:17pm
Print Post  
Smiley Yes the debugger needs to ensure the serial is up before sending trace data. 

Actually I didn't realize that this is dependent on a windows usb connection. 

I think the Arduino recommended examples needs to change to include a timeout if this is the case. What are your thoughts. Maybe we should not bother waiting for the Serial to become active and just wait a few seconds?
  
Back to top
IP Logged
 
Dennis Mabrey
Junior Member
**
Offline


Posts: 19
Location: Branchburg, NJ
Joined: Oct 22nd, 2013
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #4 - Nov 1st, 2013 at 7:08pm
Print Post  
Tim@Visual Micro wrote on Nov 1st, 2013 at 1:17pm:
Actually I didn't realize that this is dependent on a windows usb connection.


Being nitpicky but technically you need more than that.  You could be plugged into a USB but it won't return true until the com port has been opened (such as Serial monitor).  Just being plugged into a USB port won't make Serial return true.

Tim@Visual Micro wrote on Nov 1st, 2013 at 1:17pm:
Maybe we should not bother waiting for the Serial to become active and just wait a few seconds?


In your case timing out makes more sense than flat out blocking until Serial is true.   A person may want to debug a running program at a later time.  The Serial object still works and you can reconnect to it anytime.  

By the way, if Thomas has an FTDI cable or uses Xbees an easy workaround would be to configure the Remote Port project properties to "Serial1".   Serial1 on the Leonardo & Micro are digital pin 0 and 1 and it doesn't block at all.

I can confirm I can remotely debug a Leonardo using an Xbee shield in this manner.



« Last Edit: Nov 1st, 2013 at 7:09pm by Dennis Mabrey »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #5 - Nov 1st, 2013 at 7:10pm
Print Post  
Excellent. Thanks Dennis. I really miss-understood what the wait for Serial was doing. It will change to a time out in the next release!

« Last Edit: Nov 1st, 2013 at 7:11pm by Tim@Visual Micro »  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #6 - Nov 4th, 2013 at 4:49pm
Print Post  
Hello again!   Smiley
 
Happy to see, that my english is good enough - so you are able to understand the Problem...  Wink

@Dennis:
That was my first thought: oh sh..t, I have left the while(!Serial).
But that wasn't the case - at least not in that part of code I'm working with...  Wink

If I understood right, there is some other part of code where VisualMicro is dealing with.
I`d like to piggyback a further finding with this `usb/Serial-port`.
As Dennies mentioned before, the debug-behavior depends on the `open Serial connection` from the IDE (I use Atmel Studio 6.1 SP2)
The old way of debugging with the Serial.print() showed me, that at least with the arduino IDE 1.5.4 the arduino booted up and run the code even though in my code stod a  while(!Serial) in the Setup().
I realized that the IDE didn't time out the Serial-Connection quick enough when I redeployed the code. This way, my Leonardo booted up, saw the `old` Serial Connection and went on. I had to add some more code so it looked like this:
delay(4000);  // wait ca. 4 seconds to Close the previous Connection.
while(!Serial); // await the new ser. Connection...

May be that is relevant to you.

Best regards
Thomas

PS: at the moment I deployed the code without `debugging`... but this way I will mess up the remaining Problem in my code...   Wink Wink
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #7 - Nov 4th, 2013 at 4:52pm
Print Post  
Hi,

Sorry I was not clear. Yes you are right. It is not your code that has while (!Serial) it is a mistake in the Visual Micro debugger code.

If you really need this to work I can send you an email of how to change the Visual Micro config to remove the "while (!Serial)"

Thanks

ps: Your English is good  Smiley
« Last Edit: Nov 4th, 2013 at 4:52pm by Tim@Visual Micro »  
Back to top
IP Logged
 
thjakob
Junior Member
**
Offline


Posts: 23
Joined: Apr 29th, 2013
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #8 - Nov 4th, 2013 at 5:31pm
Print Post  
Hello Tim,

You were clear.
My thoughts on this while(!Serial) were before I posted here ( I doublechecked my code before...  Wink    )

So, there are two situations:
S1:
- I'd like to debug the  Setup() - so the Debugger should
   wait till the Serial Connection is opened.
S2:
- I'd like to debug some other code, some time in the
   future, so the Debugger should not wait till the Serial
   connection is opened.

Waiting some seconds will probabely solve the Problem in most situation  (presumed, I reconnect the serial connection quick enough).
The other way round:
What happens, when I interuppt the serial connection while debugging (are there any buffers that will overflow on the arduino, etc.)?

Thomas


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


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #9 - Nov 4th, 2013 at 5:40pm
Print Post  
Hello,

I am not sure how the Leonardo works. In theory you can just pull the cable and plug back in again at a later time. I think the Arduino will still attempt to send the data then drop it so we shouldn't hit a buffer problem BUT I don't know if this is true for the Leonardo.

I think an option to use a timeout might work the best for you.

Alternatively the better solution is to use Serial1 on the Leonardo with the rx/rx pins connected to the pc USB via an FTDI cable. Using Serial1 will not wait and will continue to work connected or unconnected to the pc. I think this is the best option for you right now if you can get an FTDI device or cable.
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Arduino Leonardo doesn't boot - without USB/Serialport connection
Reply #10 - Jan 2nd, 2014 at 12:56am
Print Post  
In the next release, Visual Micro waits for the 5 seconds for the  serial to become active then allows the program to continue regardless of Serial connection. This applies only to debug using the main serial port of usb "aware" processors such as is on the Leonardo and Teensy boards.

This allows a program compiled with debugging to run when no longer connected to usb. It is not recommended to run a debug version in a release environment but useful for testing purposes only.

ps: make sure your own code does not have "while (!Serial){}", this is what causes it to wait for usb connection
« Last Edit: Aug 10th, 2015 at 1:44am by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint