I recently bought two OLIMEXINO-32U4 boards on eBay. This is how I wrote the Arduino Leonardo bootloader on them using my Ubuntu Linux desktop PC and a USBasp programmer:
- Heat up your soldering iron and mount a 6 pin (2 x 3) header to the OLIMEXINO-32U4 board. The location is marked ICSP on the board.
- Plug in the USBasp programmer into a USB port and connect it to the ICSP connector of the OLIMEXINO board. Watch the polarity: In my case, pin 1 on the female connector is marked with a triangle on the cable and pin 1 on the OLIMEXINO board is marked by a square pad (the other pads are round). Because your USBasp board provides power through the ICSP connection, the OLIMEXINO board should power up and some LEDs should light. If they don’t, check the polarity.
- Download the Arduino software version 1.0.1 from http://arduino.cc
- Extract the downloaded arduino-1.0.1-linux.tgz
- Open a terminal window and go to the folder where the tgz was extracted and run the Arduino software as root:
~/arduino/arduino-1.0.1$ sudo ./arduino
- Go to menu Tools > Board and select Arduino Leonardo.
- Go to menu Tools > Programmer and select USBasp
- To burn the bootloader, go to menu Tools and select Burn bootloader. The Arduino software says “Burning bootloader to I/O Board (this may take a minute)…”. The programming starts and only the red LED on the OLIMEXINO board is lit. After a minute, the green and yellow LEDs light up too and the Arduino Software says: “Done burning bootloader”
- Disconnect your OLIMEXINO board from the USBasp.
This is it! Now, we are going to check if we can successfully program the OLIMEXINO-32U4 with the Arduino software:
- Connect the OLIMEXINO board via the mini USB connection to a USB port on your PC.
- In the Arduino software, go to menu Tools > Serial port and select the appropriate port your OLIMEXINO is connected to. In my case, it was /dev/ttyACM0. If you are not sure, start a terminal window and check the syslog just after you plugged the OLIMEXINO into the USB port. It should say something like this:
kernel: [13475.836045] usb 2-1: new full-speed USB device number 33 using uhci_hcd
kernel: [13476.025272] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
- Go to menu File > Examples > 01.Basics > Blink
- Change the LED pin from 13 to 7:
int led = 7;
- Go to menu File > Upload
- After the Arduino software has completed compiling the sketch, the green and yellow LED next to the mini USB connector should start flashing whilst the Arduino software says “Uploading…”.
- When the Arduino software has done uploading the sketch, the green and yellow LED next to the mini USB connector return to their steady on state. Your sketch should start running on the OLIMEXINO board and the green LED below the DC connector should start blinking on and off every second.
- Change the LED pin to 9 in your code, re-upload and the yellow LED below the DC connector should start blinking. Fantastico!
TIP: If the upload process does not seem to work, press and hold the RTS (reset) button on the OLIMEXINO board (the button is next to the ICSP connector), then hit the upload button in the Arduino software. Only release the reset button after you see the message “Uploading…” appear in the software’s status bar. This situation is not unique to the OLIMEXINO board, it is documented in the Guide to the Arduino Leonardo.
One thought on “Writing the Arduino Leonardo bootloader to the OLIMEXINO-32U4”