How to Reset the Dev Kit

Alright, send me one! :wink:

Just kidding, here’s the test project that causes trouble for me:

https://codebender.cc/sketch:194007 (Download the file and try it in Arduino IDE)

Actually this version does work for me, only when you increase the size of the array to 320 (for example) that it causes the glitch. But as I said, on Codebender it works fine.

So this looks like the original problem… an old issue: https://github.com/arduino/Arduino/issues/1242

I tried with int array[315] (1 893 bytes) and it requires a manual reset to upload a new sketch with Arduino 1.6.6, but also with CodeBender.

With int array[612] (2 487 bytes) the serial monitor cannot connect anymore, but I think that it is a small annoyance.

Thanks @DSSiege11 for the nice test! If a fix is not found upstream, we could maybe ask @bateske to change the bootloader (put bootKeyPtr at 0x9FF instead of 0x800).

2 Likes

Yeah no problem, wow good find. Between finds like this and the sound driver it’s not the worst thing that production is late or we couldn’t have been able to include fixes for everyone!

Thanks this is incredible!

1 Like

Good to hear it’s nothing I was doing wrong. Strange though that for me it seemed to work in CodeBender… Going to test it again this evening!

@bateske: So in what way can/will this be fixed now?

Do you know?:
If you’re using the latest standard Arduboy library, you can hold down the UP and LEFT buttons while powering up, to put the Arduboy into safe mode to allow sketch upload, as described here.

1 Like

I can recompile the bootloader with this and post it online, or if someone else wants to beat me to the punch then just post it up!!

I’m just using the standard catarina leonardo bootloader. In other news, I’m going to try for Arduino at Heart if it isn’t too expensive.

1 Like

Yes I’m using the standard library and back when the glitch first happened (in a project that wasn’t Arduventure) I tried it and it didn’t work, only the shorting pads reset worked for me… I’ll try it again with Arduventure this evening.

I don’t know much about Arduino hardware and bootloaders but reading about it it seems you need some extra hardware in case I wanted to update the bootloader with a fixed one?

You need another arduino, wires and solder… not too bad, I’ll send you some with the developer kit if you need it :wink:

Or some other type of AVR programmer, such as the USBasp. A USBasp clone is very inexpensive from sources on eBay.

There aren’t many cases when holding UP and LEFT wouldn’t work. You have to have them held while plugging into the USB port to apply power. The screen should remain blank since it doesn’t get initialised.

@davidperrenoud: So I tried the test in CodeBenders again and you’re right, it’s doesn’t work there either. The reason it worked for me at some point is cause I had some extra code in the setup function that set all elements of the array to 0 which makes it work for some reason but of course isn’t a solution to the problem.

@MLXXXp: Tried the UP LEFT method and it doesn’t work… The screen does stay black when I plug in the USB cable but the moment I upload something the last uploaded sketch appears.

That would be great :smiley: In the meantime I might just start on a simpler game that doesn’t exceed the 188X bytes of RAM, or I could just continue with Arduventure and go for a reset record :stuck_out_tongue: .

See if you can get the reset record before your chip fails from exceeding the rated 10000 flash write/erase cycles. :wink:

Haha I’ll just work on a new project instead :wink:

The geniuses were at it again!

@Dreamer3 reappeared on GitHub, @NicoHood joined us on IRC and it seems that @facchinm from Arduino.cc found a solution to the bug:

With this fix, the Arduino IDE will be able to reset Leonardo boards with the boot key at either 0x800 (Arduboy Dev kit) or RAMEND-1 (Arduboy retail).

So for the Arduboy retail, we can either:

  • Use the Hoodloader2 bootloader
  • Use the latest LUFA bootloader
  • Modify the current Caterina (LUFA) bootloader to put the boot key at RAMEND-1
2 Likes

Another software possibility is to add a reboot key sequence. I’ve done this while working on other projects… (hold down all 4 Dpad buttons at once to trigger a reboot)… Then you can re-flash a large program without having to unplug the USB (which gets old fast). I’m not sure if that sort of thing belongs in core lib though… or maybe as an option? It’s actually pretty hard (on the dev kit) to push all 4 buttons at once though.

If the screen stays black the safe mode is working - that’s all it does - freeze the boot so the Arduino IDE can request a USB restart which should go right into the bootloader and result in your new sketch being uploaded… I’ve never seen this fail, so I’m not sure what problem you’re hitting.

If the screen stays black the safe mode is working - that’s all it does -
freeze the boot so the Arduino IDE can request a USB restart which
should go right into the bootloader and result in your new sketch being
uploaded… I’ve never seen this fail, so I’m not sure what problem
you’re hitting.

left+up doesn’t work with me half the time, the screen goes black, but uploading a new program just makes it reboot with the old code.
Grounding reset is the only method I’ve found that works consistently.

Could it be dodgy hardware? I seem to be a magnet for weird hardware faults.

No idea. The reason reflashing breaks is because a large sketch can overwrite the memory that the USB code users to store a ā€œrebootā€ flag. What happens when USB asks for a reboot is a flag is stored and then a little later it’s checked and if it’s still set it reboots. This is because evidently sometimes there are false positives and you have to ā€œundoā€ the flag (which isn’t possible because they don’t save it, but still). Silly boot loaders.

All safe mode does is see if both buttons are pressed and then go into a infinite loop (thereby leaving memory alone). This allows the reboot flag to be set successfully (and not changed)… causing the device to reboot.

That’s all safe mode does… if your device reboots right before flashing then safe mode has done it’s job. I have no idea why AFTER the reboot it would refuse to flash the new code… perhaps the delay just isn’t long enough. Someone else was having this problem that it took a few seconds to start flashing a new program and then they rebooted their PC and flashing started instantly.

1 Like

Hey it’s time for boot loaders!

Is there a fix we can use today that will work? It looks like everything here would still require the push request from Arduino? Is that right?

We do have a reset button at least now…

pinging @Dreamer3 @davidperrenoud

The fix needs to make it into a released version of the IDE so that that compiled sketches and the boot loader agree on the new memory location (end of RAM)… that said I think you can still incorporate the fix into the boot loader so that when the IDE catches up the problem ā€œfixesā€ itself… I"m not 100% sure though… I’d have to re-review the whole thread and see what the ā€œtransitionā€ plan is for getting from the old system to the new system.

I posted a new question on the thread. I think we should update our boot loader to check both the OLD and NEW locations for the magic key… that would make it future proof for when the Arduino core gets the patch… and if it never does it also wouldn’t hurt us in any way.

1 Like