I’ve read through a few of the postings here and a lot of the same problems in getting the Leonardo bootloader driver loaded and working for the Atmega32u4 Breakout Board. Below is a description of my system environment, the symptoms I experienced and my workarounds.
I am running Windows XP-Pro SP3. My AVR programmer is an AVRISPmkII and I am using AVR Studio 5. My version of the Arduino IDE is 1.0.
Before using the procedures below, I did the needed modification to the bootloader driver’s .inf file and was able to load the driver (after burning the Leonardo bootloader on the Atmega32u4). But the problem was getting the bootloader driver to work (I kept getting a code 10 error).
Overall, the weird thing you need is an application loaded onto the device after the Leonardo bootloader is also burned into “flash” memory. Others in this forum have been experiencing the same thing. Again this is what worked for me given the tools I had at my disposal.Step 1
: load the bootloader onto the ATmega32u4. There are a number of ways and programmers to do this, but given the tools I have on hand this is what I did.
1.a. Apply a 5V power source between the 5v and one of the GND pins on the breakout board.
1.b. Connect the AVRISPmkII programmer to the ATmega32u4 through the 6-pin isp breakout on the board. If your programmers firmware is up to date and the AVR Studio 5 is already loaded (with the AVRISPmkII’s drivers working) you should get a green light on the programmer.
1.c. Use AVR Studio 5 to burn the bootloader (….\arduino-1.0\hardware\arduino\bootloaders\diskloader\DiskLoader-Leonardo.hex ) into the program “flash” memory. To get to the programmer interface in AVR Studio 5 from the menu it is Tools->AVR Programming (make sure the right device is selected and target programming speed is around 64kHz). After burning the bootloader into “flash”, keep the programmer interface up for the next step.Step 2
: set the hardware and lock fuses for the ATmega32u4. I am not going to say that these are the right fuse settings, but they worked for me and they were based upon reading the datasheet and the boards.txt file. Word of warning here. For some boards you can actually “brick” your device (render it useless) with certain settings. So be careful here (if anyone else can comment about any risks that might be associated with this particular device and this board, please post something).
2.a. from the AVR programmer interface select the “fuses” link and program the following hex values for each of the hardware fuse registers:
Extended: 0xFB (boot.txt says “cb”, but the upper nibble does nothing according to the datasheet).
2.b from the AVR programmer interface select the “Lock bits” link. Program the following hex value into the lock bits register:
I am pretty sure that what this does is set up the microcontroller up so that applications are not written over the bootloader that you just burned into the “flash”. Step 3
: burn application program into the device (without overwriting the bootloader). This is the weird workaround that many seem to have to do. I had to do this with AVR Studio 5 and a small AVRGCC C program in order to get the Leonardo bootloader to work in Windows XP. It is strange, but it seems like you have to have an application burned into the “flash” after the bootloader in order for the Leonard driver to work correctly with the operating system.
3.a. I started an new project in AVR Studio 5 for the ATmega32u4 and wrote a small variant of the “blink” program:
- Code: Select all
// change the port pin to OUT
DDRC = 1<<PC7;
PORTC = 1<<PC7;
//TODO:: Please write your application code
PORTC = PORTC ^ (1<<PC7); // TOGGLE THE BIT
3.b. Burn the program into the “flash” using the AVR Programmer interface (like you did with the bootloader in step 1. If you have the lock bits set up right, it will be burned in a different location in flash than the bootloader).Step 4
. Disconnect the AVRISBmkII programmer from the board, disconnect your 5V power source and connect an LED between C7 (according to my short program) and ground. Next reconnect the 5V power source. If everything is going right you should observe the following behavior.
4.a. Again reconnect the 5V power source if you have not done so already.
4.b. Press the reset button. For about 7-9 seconds the LED should toggle (glow) slowly, then blink fast after the 7-9 seconds. When the LED is toggling (glowing) slow, the bootloader is running. It runs for 7-9 seconds (and making the LED glow this way). After that, the application program kicks in (in this case just causing the LED to blink fast). If you are observing this behavior, I think this means that you successfully loaded the bootloader and the application.Step 5
. Before connecting anything to the USB port on your computer, you have to modify the .inf file for the driver.
5.a. Open “…\arduino-1.0\drivers\Arduino Leonardo.inf” in an editor (I used WordPad).
5.b Just like Adrastos and Seannerd, I modified as follows: change "%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0034&MI_00" to "%DESCRIPTION%=DriverInstall, USB\VID_2341&PID_0034&MI_00, USB\VID_2341&PID_0034&Rev_0100, USB\VID_2341&PID_0034" in both places that it shows up.
5.c. Save the .inf file and close your editor.Step 6
. Try to get the Leonardo driver loaded in Windows XP for this board. Now with the 5V power supply connected to the board, connect the board to your computer USB port.
6.a. Again, with 5V power supply connected to the board, connect to your computer USB port. If the LED is blinking fast, XP won’t detect the USB bootloader running through the USB connection, because the application is running.
6.b. Click the “reset” button on the board. Now you should hear the beep-bop on your XP machine and get prompted to load the “Arduino Leonardo bootloader”. Go through the familiar windows to do this so that the driver is searched for in “…\arduino-1.0\drivers”. Don’t worry about the 7-9 second duration that the bootloader runs and loosing the indications showing it has been detected in Device Manager. Just go through the windows to load the bootloader driver. It should load even after the devices stops running the bootloader and starts running the application program.
6.c. After the bootloader is done loading in XP, hit the reset button again on the board and look at the “Ports (COM & LPT)” devices detected. You should see your Arduino Leonardo listed without error indicators and assigned a COM port (at least while the bootloader is running)Step 7
. Compile and upload the Blink example from the Arduino 1.0 IDE. It takes a little coordination, but make sure you select the Arduino Leonardo as the “Board” and click the reset button on the board so you can select the right COM port (even though it will disappear in device manager in a few seconds). Again this may take a few times based upon when you click the upload button and when you click the reset button. After a successful upload, you will be prompted to reload the Arduino Leonardo bootloader. Yes, you have to reload the bootloader. After that, XP will recognize the device as an Arduino Leonardo with an assigned COM port as your Aruino IDE uploaded version of Blink is running.
I hope this helps shed some light on the problems in getting the driver to work in Windows environments. I don’t know, maybe it is just an XP thing.