Go Down

Topic: Can't upload to Leonardo  (Read 964 times) previous topic - next topic

3Dgeo

Mar 17, 2018, 11:11 pm Last Edit: Mar 17, 2018, 11:48 pm by 3Dgeo
Hi,

I cant upload to Leonardo, first I tried with older version IDE, now with 1.8.6.
It just get stuck for a long time at "uploading" (it resets Leonardo, RX flashes 2 times), and then it says that it's done uploading, but code in the Leonardo remains the same.

It seems that my old sketch works - I played with keyboard emulation. Now it appears as a keyboard, but I added condition - after reseting keyboard emulation starts only if Pin11 is grounded (set as pullup) so I don't know why it appears as a keyboard. If I ground Pin11 it starts moving cursor up, so keyboard emulation starts only then...

Any ideas whats wrong?



ballscrewbob

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

sterretje

Under file -> preferences in the IDE, enable verbose output during upload. Post the complete result here (using code tags).
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

3Dgeo

I'm trying upload simple blink, I don't remember my old sketch thats in Leonardo now.


Code: [Select]
Sketch uses 4128 bytes (14%) of program storage space. Maximum is 28672 bytes.
Global variables use 149 bytes (5%) of dynamic memory, leaving 2411 bytes for local variables. Maximum is 2560 bytes.
Forcing reset using 1200bps open/close on port COM26
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, } => {}
PORTS {COM3, COM4, } / {COM3, COM4, COM26, } => {COM26, }
Found upload port: COM26
C:\Users\GEO\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/bin/avrdude -CC:\Users\GEO\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf -v -patmega32u4 -cavr109 -PCOM26 -b57600 -D -Uflash:w:C:\Users\GEO\AppData\Local\Temp\arduino_build_660049/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Dec 16 2016 at 13:33:19
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\GEO\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"

         Using Port                    : COM26
         Using Programmer              : avr109
         Overriding Baud Rate          : 57600
         AVR Part                      : ATmega32U4
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PA0
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 200
         StabDelay                     : 100
         CmdexeDelay                   : 25
         SyncLoops                     : 32
         ByteDelay                     : 0
         PollIndex                     : 3
         PollValue                     : 0x53
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    20     4    0 no       1024    4      0  9000  9000 0x00 0x00
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : butterfly
         Description     : Atmel AppNote AVR109 Boot Loader

Connecting to programmer: .avrdude: butterfly_recv(): programmer is not responding

avrdude: butterfly_recv(): programmer is not responding

sterretje

#4
Mar 18, 2018, 03:40 pm Last Edit: Mar 18, 2018, 03:41 pm by sterretje
The last line tells you that your new code is not uploaded.

You might have the incorrect port selected in the IDE. Compare with devicemanager. When you reset (reset button) a Leonardo, device manager will first show you something like "Arduino Leonardo (bootloader)" (for approx 5 seconds) followed by something like "Arduino Leonardo", both with associated port numbers. The IDE needs to be set to the latter. In my experience, the bootloader is one number higher than the other (e.g. COM13 for the bootloader, COM12 for the other).

Below output example on my system.
Code: [Select]
Forcing reset using 1200bps open/close on port COM12
PORTS {COM12, } / {} => {}
PORTS {} / {COM13, } => {COM13, }
Found upload port: COM13
...
...


One possible workaround if you can't get the above right is to press and release reset while it is showing
Code: [Select]
Forcing reset using 1200bps open/close on port COM26
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
PORTS {COM3, COM4, COM26, } / {COM3, COM4, COM26, } => {}
...
...
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

3Dgeo

Thank You for your help presheate,

I don't see any other port number, Leonardo always on 26 port (in device mannager and in IDE).
I've tried resetting on upload many times - same. Is it possible that my Leo is broken?

sterretje

If you don't see "Arduino Leonardo (bootloader)" in device manager when you press reset, something is wrong; I can't tell you what because I don't have the problem.

What is on com3 and com4?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

3Dgeo

"bootloader" never shows next to Leo in device manager, com 3 and 4 is for some other devices (it's a laptop), they always bin there...

If bootloader is bad, than why LEO shows as a HID device (keyboard)? It shouldn't show up at all, isn't it?

Trying to burn bootloader with IDE...

ballscrewbob

Some HID sketches IIRC did something to the bootloader on the LEO's.

If you cannot get it into bootloader mode (quickly double press reset) then some people had to re-load the bootloader which would involve either another Arduino as ISP or some other external ISP device.

My advice is from posts dating back quite a while that I came across a long time ago.
If your was an older HID sketch it is possible you didnt know about these types of issue and apparently they can also affect MIDI sketches for the LEO's.

Use the SEARCH option at the top of the page to search for "leonardo bootloader" I am sure that will give you some clues.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

chrisspurgeon

I'm having a more fundamental problem with my Leonardo. When I attempt to upload any sketch, it's impossible to choose an appropriate port. In the Arduino IDE (version 1.8.7 on MacOS 10.14.2) I go to Tools --> Port, and there's no port that corresponds to any USB connection. My Leonardo is connected via USB, and I have the board type set to "Arduino Leonardo". I've tried the usual things, like disconnecting and reconnecting the board, quitting and reopening the Arduino IDE, and rebooting my laptop, all to no avail.

Any idea what's wrong?

Thanks!
Chris Spurgeon
TWITTER: @chrisspurgeon

Go Up