I have a Lilypad USB that was mistakenly programmed as a micro board. It is no longer recognized by Windows when connected to USB. When I press reset 2X quickly, it shows up for a few seconds as a Lilypad USB in the device manager - but resets again to an unknown device.
I followed some advice in a previous posting to try to upload an empty sketch immediately after the 2X reset while it shows up as a Lilypad USB. This does not work as the device always resets again back to an unknown device and the upload fails.
In a related question, if there is no solution to this, is it possible to use a second Lilypad USB to re-program the bootloader in the corrupted Lilypad USB?
I don't have any direct LilypadUSB experience, but LilypadUSB to another LilypadUSB ISP should be just like any other Leonardo-type Arduino procedure. Unfortunately, tutorials for Leo to Leo ISP are rare. Here's one that should work for you. You will need to use the ICSP headers on your LilypadUSBs.
As an alternative I think it is likely Nick Gammon's Bootloader sketch will run on the LilypadUSB and burn a Leonardo bootloader to another LilypadUSB.
I was able to successfully program the broken Lilypad USB with the Leonardo bootloader using Nick Gammon's tools as suggested. However when I connect the newly programmed Lilypad to the PC USB port, the device is not recognized by Windows. I have tried multiple ports.
I have searched on this issue and my current direction is to look into the fuse settings on the device.
If you burned the bootloader with Nick's tools I think the fuses are probably fine. What I would suspect at this point, knowing the bootloader was burned without error, is a bad USB cable or bad solder connection of the USB port on the Lilypad.
If you are not able to get it going and upload to it in the conventional manner, you could upload sketches to it via ICSP on the menu Sketch, Upload Using Programmer (or older versions of the IDE: File, Upload Using Programmer). So the bad Lilypad is not a total loss.
For the sake of learning and also having the convenience of programming sketches using the Arduino IDE (there are six wired connections required to program using ISP mode), I looked into the possibility of programming the actual Caterina-LilyPadUSB bootloader hex file, which exists in the Arduino bootloader directory.
First off the real difficulty here is that the LilyPad USB is a 3.3V device. I assume that this requires it to be programmed with another LilyPadUSB, or other 3.3V device. I think what this has revealed is that there doesn't seem to be much information on this setup.
The ArduinoISP didn't work at all - it hangs. Nick Gammons's bootloader worked but is limited to programming a Leonardo bootloader. I decided to go down the path of using Avrdude to flash the device. After some study of fuses and locks, I believe you are correct that the fuse/lock setup included in the Nick's Leonardo bootloader is correct for the LilyPadUSB.
I have gotten to the point where I can run Avrdude with the following commands:
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
I suspect the problem is that Avrdude is not connecting to the correct USB port. If I don't specify a port, it shows com1, which always shows up in the Arduino IDE but never works. The ISP LilypadUSB shows as COM31 in the Windows Device Manager. If I specify the port by including:
-P com31
I get the same error.
Any ideas on how to get Avrdude to connect to correct port?
Are you using an Arduino as ISP? If so, what board are you using? You can use 5v programmer or arduino board if you don't have other connections on the lilypad.
Hey you reminded me of something with that 3.3V thing. Find this section in Nick's script:
// ATmega32U4
{ { 0x1E, 0x95, 0x87 },
0x7000, // start address
#if USE_ATMEGA32U4
leonardo_hex,// loader image
sizeof leonardo_hex,
#else
0, 0,
#endif
0xFF, // fuse low byte: external clock, max start-up time
0xD8, // fuse high byte: SPI enable, boot into bootloader, 1280 byte bootloader
0xCB, // fuse extended byte: brown-out detection at 2.6V
0x2F }, // lock bits: SPM is not allowed to write to the Boot Loader section.
and edit the extended fuse changing it to CE. Re-upload the script to your programmer Arduino and re-burn the bootloader and let's see how it does. That is the brownout detector bit, should have worried about that a little more than we did....
Ok, the wiring is the same for Nick's bootloader as for Arduino as ISP. Did you do this including setting Tools, Programmer to "Arduino as ISP"?:
Open the example script ArduinoISP from the File, Examples menu. Edit the line
#define RESET SS
to say
#define RESET 10
Upload it to your working LilypadUSB
On the Tools, Programmer menu choose "Arduino as ISP"
Connect the Lilypads together the same way you did when you used Nick's bootloader sketch. You connected all the ICSP header pins of one Lilypad to the other Lilypad except pin 5, and connect pin 10 of the programmer Lilypad to the reset pin of the target Lilypad, which is pin 5 on its ICSP header.
And as an alternative if you are able to get Nick's sketch to run and it reports that it burned the Leo bootloader, you could repeat that process and change Nick's sketch to burn the extended fuse to the value needed for the LilypadUSB. The extended fuse is different for Leo vs. LilypadUSB.
I did what you suggested - changed Nick's sketch to program the extended fuse to 0xCE, which is the setting for Lilypad USB. This did not make a difference - the programmed board was not recognized as a USB device.
As I mentioned in a previous post I believe I can use Avrdude (command line) to program the LilypadUSB bootloader. But I have not been able to get Avrdude to find the ISP Arduino USB port. I have searched on the errors, far and wide.
The ISP Arduino is listed correctly as a USB device (COM31). But Avrdude will not connect to it.
If you can use Nick's sketch to burn the bootloader, you should be able to use the exact same wiring and upload the File, Examples, ArduinoISP sketch (change SS to 10 before uploading the sketch to the programmer Arduino). Then set Tools, Programmer to "Arduino as ISP", and do Tools, Burn Bootloader. If that is successful, you can go on the menu to File, Preferences and checkmark the show verbose output during upload and click ok. Then repeat burning bootloader and it will show you the full avrdude command which you could use on the command line.
If, after burning the bootloader, you can't get the USB of the bad board to show up on your computer, the solder joints for the USB connector on the bad board may be bad or other parts of the USB circuitry on the board may be damaged. Just for fun, try a different USB cable, too.
Here is an update on this issue. I was able to successfully burn the bootloader to the Lilypad USB.
Previously I attempted to us one Lilypad USB to burn the bootloader to another Lilypad USB. However the 32u4 USB reset crashes the bootloader process and there is no fix for this that works and I looked far and wide and tried many different methods. Note that the Lilypad USB board does not function with the Leonardo bootloader installed.
My next move was to use a 328 board to program - main requirement here is the 3.3V. I purchased an Arduino Pro Mini 3.3V/8Mhz and a FTDI breakout board (Sparkfun) to use as the programmer. This worked.
dmjlambert:
I don't have any direct LilypadUSB experience, but LilypadUSB to another LilypadUSB ISP should be just like any other Leonardo-type Arduino procedure. [...]
I was able to download a bootloader into LilyPad Arduino USB using an Arduino Mini Pro. Nothing special about Mini Pro: it was simply the only other board I had. I followed the steps from the well known ArduinoISP tutorial (even though it was written for Arduino Uno). The procedure worked from the first attempt. Later I had repeated the procedure to re-burn the bootloader (locked myself out by doing low power mode incorrectly). More details in this thread, and this brief report.
Yes, that's great! I like the Arduino collection, there's really just a very few board types. You can call Pro Mini, Nano, Lilypad, or any other ATmega328P-based board an Uno, and you can even burn the Optiboot bootloader on them if you want. And you can operate any of the boards at 3.3V or 5V, just do it. With simple sketch or boards.txt adjustments you can even compensate for different crystal frequencies. And the same thing goes for Leonardo: you can just call a Pro Micro, Micro, LilypadUSB, or other ATmega32U4-based board a Leonardo. Differences are mostly just the shape and size of the board and on-board amenities.