0

My question involves a Sparkfun Fio v3, similar to the Arduino Fio.

I had a student who was testing his understanding of the Keyboard library. He uploaded a sketch that continuously sends output, emulating a keyboard, saying "Hello!If you're reading this, then you did things right!" (I don't have his code, unfortunately, so I can't post it.)

So, now, whenever I connect it via the USB, I can't upload a new sketch because the Serial channel is clogged with this output. (Error Message: "avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x00" and so on)

I've tried putting the cursor inside the header comment in 'Blink', so that the new characters that are being spammed to my code are all inside a comment, and this makes it possible to compile, but it won't sync and upload. I've tried burning a new bootloader, and this fails as well (Message: "Error while burning bootloader.").

It seems to me that the only way to get this device back is to reset the memory without connecting to a computer, but I can't find any way to do this.

Is there any way to rescue this device?

0

Hehe... This is a fun one to try and get out of. The normal way is to reflash the bootloader...

If it's the same as the Leonardo you get about 8 seconds after a reset while just the bootloader runs before it starts to spam everything with text. So you can try:

  1. Open notepad or something similar
  2. Plug in the board
  3. Press and hold the RESET button (or connect the RESET pin to GND with wire)
  4. Open the IDE and load Blink.ino

Now the tricky bit. If the correct serial port isn't selected, you need to, within the space of 8 seconds:

  1. Release the reset button.
  2. Let the PC enumerate the device
  3. Open the serial ports menu and select the right port
  4. Press and hold the RESET button again.

Now you can program it, in a similar way:

  1. Press UPLOAD in the IDE.
  2. Just before it finishes compiling (turn on verbose output can help you time it better) release the RESET button.

If you timed it right the bootloader should run and accept the new program before the existing sketch runs and starts spamming everything.

  • I tried this many times, and couldn't get anything to work. Thanks, though. – Mburg Dr J Apr 24 '18 at 2:50
0

Majenko's suggestion should work - the bootloader should give you a few seconds in which to upload the new sketch, although timing it can be critical.

If that fails, you can reburn the bootloader which will erase the existing sketch. I have a sketch which uploads various bootloaders, the ATmega32U4 being one of them.

Judging by the schematic and also a photo of the board, you would need to solder on a 6-pin header (circled).

Fio photo

Then run 6 wires as described on my page above to another Arduino (see "Wiring for Leonardo") and burn the bootloader. That only takes a couple of seconds. You could make up a suitable cable with a 6-pin socket to make it easier next time a student does the same thing. :)

This will definitely work (if you get the wiring right) because it uses ICSP programming, which means the sketch on the board doesn't have a chance to run. In fact the programming is not via the USB interface at all.

The bootloader uploading starts with a chip erase, which therefore removes any existing sketches.

  • Thank you twice! I discovered that I had already downloaded your sketch before, I think this helped me rescue a Mega some time ago. – Mburg Dr J Apr 24 '18 at 2:51
  • Your sketch successfully identified the SF Fio V3 as an ATmega32U4, and transferred the bootloader. It took a little fiddling because SF didn't put a dot to tell me which end is up on the ICSP header, and it is upside-down compared to the Uno I was using to send it. However, now my Mac won't recognize the Fio at all when I connect it to the USB. When I look in /dev/, I see a new device, so linux is picking it up, but the Mac isn't recognizing it as anything interesting. I'll do a little more playing. I realized that this computer is new so I might just not have all the drivers installed. – Mburg Dr J Apr 24 '18 at 2:58
  • A Leonardo driver should do it. – Nick Gammon Apr 24 '18 at 8:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.