Leonardo auto-reset problem #1242

mkwired opened this Issue Jan 22, 2013 · 5 comments


None yet
7 participants

mkwired commented Jan 22, 2013

I found a design flaw in how the Leonardo auto-reset works. A sketch can affect how the bootloader behaviors. This flaw can cause the bootloader to jump to the sketch and therefore never go into a mode where it can be reprogrammed using the auto-reset feature. For more information, see my linked thread below on the Arduino Forum.

I noticed that the code was based on the LUFA codebase, so I checked the latest release of LUFA to see if they had a similar problem. In my opinion they do, but the LUFA group doesn't think so. They recognized that the Arduino codebase had this problem but not the LUFA codebase. See the linked thread below for that correspondence.



ffissore added the New label Feb 27, 2014

matthijskooijman removed the New label Sep 11, 2014

ffissore self-assigned this Jul 1, 2015

Still not fixed?

More discussion #2474


NicoHood commented Dec 2, 2015

Please try HoodLoader2 for 32u4 and report your problems.

It'd also be useful if you post the OS you are using. I noticed linux sometimes opens the port at 1200 baud rate which makes it reboot. Then we have the modem manager etc. And on Windows we have other problems.

I think we can close this issue and move to the one you linked, because it describes the issue better and is most up to date.


cmaglie commented Dec 2, 2015

@NicoHood the problem is that a patched bootloader is not compatible with the current bootloader and we have a lot of Leonardo boards in the wild.

I see:

                                *(uint16_t *)(RAMEND-1) = *(uint16_t *)MAGIC_KEY_POS;
                                *(uint16_t *)MAGIC_KEY_POS = MAGIC_KEY;
                                // for future boards save the key in the inproblematic RAMEND
                                // which is reserved for the main() return value (which will never return)
                                *(uint16_t *)MAGIC_KEY_POS = MAGIC_KEY;

how the IDE should determine the MAGIC_KEY_POS value?
Or maybe there are no compatibility issues and I'm missing something?


NicoHood commented Dec 2, 2015

Its simple:

  • Fix the bootloader (not only this issue, a lot of other bootloader issues as well).
  • Make the bootloader also accept the old address, so new Addresses and old are both supported
  • Add a submenu for leonardo aka "BootLoader" with v1.0 and 1.1
  • As an alternative you could detect the bootloader with a special PID

Patching the bootloader isnt the problem. The patched bootloader is just better and accept both methods. The "confusion" could only happen in the IDE side, where you need to select "new bootloader" somewhere, do explicite fix this issue. However as described the old option would still work if you patch the bootloader correct.

@cmaglie cmaglie assigned cmaglie and unassigned ffissore Dec 2, 2015


facchinm commented Dec 3, 2015

Closing as duplicate of #2474 , continuing there

facchinm closed this Dec 3, 2015

@ffissore ffissore modified the milestone: Release 1.6.7 Dec 4, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment