Pages: [1]   Go Down
Author Topic: Leonardo does not show Serial port after application loaded - reset? SOLVED  (Read 988 times)
0 Members and 1 Guest are viewing this topic.
Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I have some Leonardo boards, when I load a certain application, it kills the board in that Serial no longer shows and it can not be uploaded to again via USB.  

On the Leonardo - Is there a way to either reload the bootloader / reset the board or load a new application using an external usb/serial converter?

I have a FTDI Basic and tried that, but maybe due to the fact that the serial port pins are a secondary serial port, the standard method of loading a script does not seem to work.  If it should work using standard pins, I'll try again.  If reloading the bootloader clears the application, that may work as well, just not sure how to do that with the Leonardo.  If I need an external programmer, then I may get one so I can revive and kill them over and over to see what is the root cause, etc.

Details:
Working:
When I plug it in, it shows Com port 70 .. then that goes away and port 71 shows and works - can be uploaded to.
Broken (after loading application):
When I plug it in, it shows Com port 70 .. then that goes away and port 71 does not show.

Thank You
« Last Edit: December 13, 2012, 06:27:07 am by marklar » Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You should be able to load the bootloader through the ICSP header using an external programmer.

I have used these tutorials for the UNO, but you will need to get the correct bootloader for the Leonardo:

Using the Arduino software - http://startingelectronics.com/tutorials/arduino/arduino-uno-burning-bootloader-linux/

Using Atmel Studio - http://startingelectronics.com/tutorials/arduino/arduino-uno-burning-bootloader-avr-studio/
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the pointers, I'll work on a bootloader solution if there is no way to update the sketch via the serial connection and USB to Serial converter.  The bootloader is not the root cause, it is the application.  So if I can just reload the Blink sketch for example, it should revive the board.

If this was a standard board, I could just hook to the serial pins and reload the application using the USB FTDI Basic adapter.  Are there "pins" for the primary serial / is it possible to load a sketch onto the Leonardo this way?
Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I found another post that seems to answer my question. 
http://arduino.cc/forum/index.php?action=printpage;topic=112060.0

Summary: You can't use a FTDI Breakout to upload a sketch to the Leonardo.  So if you upload a program that makes the serial connection stop working - you need an external programmer (hopefully) to fix it.  I have not tried the external programmer as I don't have one yet.

If I am able to revive the software killed boards I'll post details.

Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Update: Fixed.

I was able to use ArduinoISP to reload the bootloader using an old MEGA as a programmer.  This revived both boards and I was able to reload Blink - they feel new again.

So if anyone has an issue with the Leonardo not showing the serial port after loading a sketch, download ArduinoISP and use as directed.  If the only other board, this may help (I didn't have to do that since I had other boards around to use as a programmer, just a FYI).
http://petervanhoyweghen.wordpress.com/2012/09/16/arduinoisp-on-the-leonardo/

Logged

Florida
Offline Offline
Sr. Member
****
Karma: 4
Posts: 431
hookedup!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Root cause found and fixed .. a word of warning about Leonardo and related tip.

The root cause of the problem seemed to be an error in an interrupt or setup, causing the system to keep re-running setup and hence not showing the port. 

Since error handling is not enable on the arduino, I used another trick to catch the error and keep the system from going into loop / dea mode.  The details below explain the code change.  

Create a variable ..
byte setupRunTimes = 0;

Then in setup .. add this code before any other code, except Serial.begin(), in void setup():
Code:
  setupRunTimes++;
   if (setupRunTimes>1){
      return;
   }

Add this code in the first part of void loop():
Code:
 if( setupRunTimes > 1 ){
    Serial.println("error on setup");
    delay(1000);
    return;
  }

Hope that helps someone.
« Last Edit: December 14, 2012, 01:01:55 pm by marklar » Logged

Pages: [1]   Go Up
Jump to: