I also somehow bricked the 32U4 on my Arduino Yun.
The steps described above didn't totally work for me (i am on OSX, and the path you mention /etc/base.hex is not correct, should be /etc/arduino/base.hex as you point out in the step before). Also, i didn't use telnet but SSH (since it's OpenWRT based, works fine). Thanks a lot for posting this, i was able to unbrick it also
For anyone else who needs to figure this out (and perhaps myself if i google this in the future :P) here are the steps i took to fix it.
[edit: i replaced the local ip-address by 'arduino.local', which should also work for you if your computer is on the same network as the Yun, either by ethernet or wifi]
SYMPTOMS:
- In the Arduino IDE, under TOOLS -> PORT, there are no /dev/tty.usbmodem411 and /dev/cu.usbmodem411 showing up
- TX/RX/L13 LEDs on the Yun board are not blinking
- Same thing happens if you try on different computers
CAUSE:
32U4 Serial communication is bricked
SOLUTION (on OSX, other OS are similar):
1. Download the following file: Dropbox - File Deleted - Simplify your life and leave it in the Downloads folder.
OR compile your own (based on below code), and locate the compiled .hex file:
#include <SPI.h>
#include <Bridge.h>
void setup() {
Serial.begin(9600);
Bridge.begin();
}
void loop() {
Serial.print("Hello");
}
2.
Make sure the Yun is connected to your Wifi network, or connect to the Arduino-Yun-XXX wifi network.
3.
Open the Arduino IDE and under TOOLS -> PORT select the Arduino Yun on the network. In the bottom right corner you can see the IP-address of the Yun. Write it down.
4.
Start the Terminal application on your Mac, and type the following (replace the ip-address with your Yun's ip as written down in the previous step):
scp ~/Downloads/unbrick_32u4.hex root@arduino.local:/etc/arduino/base.hex
It will say something like this, just enter 'yes' and press ENTER:
The authenticity of host 'arduino.local (192.168.240.1)' can't be established.
RSA key fingerprint is 45:31:f5:b8:a1:4e:3e:18:cd:da:fc:e2:c5:ca:68:8d.
Are you sure you want to continue connecting (yes/no)? [b]yes[/b]
Warning: Permanently added 'arduino.local' (RSA) to the list of known hosts.
It will then ask you for your password (default = 'arduino'):
root@arduino.local's password:
unbrick_32u4.hex 100% 28KB 28.1KB/s 00:00
5.
Then, type the following command in your Terminal (again, replace with your own Yun's IP-address):
ssh root@arduino.local
and again enter your Yun's password and press enter:
root@arduino.local's password:
6.
If will show you the Linino shell:
BusyBox v1.19.4 (2013-08-07 16:16:02 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
___ ___ ___ ___
/\__\ ___ /\__\ ___ /\__\ /\ \
/:/ / /\ \ /::| | /\ \ /::| | /::\ \
/:/ / \:\ \ /:|:| | \:\ \ /:|:| | /:/\:\ \
/:/ / /::\__\ /:/|:| |__ /::\__\ /:/|:| |__ /:/ \:\ \
/:/__/ __/:/\/__/ /:/ |:| /\__\ __/:/\/__/ /:/ |:| /\__\ /:/__/ \:\__\
\:\ \ /\/:/ / \/__|:|/:/ / /\/:/ / \/__|:|/:/ / \:\ \ /:/ /
\:\ \ \::/__/ |:/:/ / \::/__/ |:/:/ / \:\ /:/ /
\:\ \ \:\__\ |::/ / \:\__\ |::/ / \:\/:/ /
\:\__\ \/__/ /:/ / \/__/ /:/ / \::/ /
\/__/ \/__/ \/__/ \/__/
_______ ________ __
| |.-----.-----.-----.| | | |.----.| |_
| - || _ | -__| || | | || _|| _|
|_______|| __|_____|__|__||________||__| |____|
|__| W I R E L E S S F R E E D O M
root@Arduino:~#
7.
Type the following commands:
cd /etc/arduino/
ls -la
It should show you the base.hex file in the list.
Then continue with these commands:
cd /usr/bin
./merge-sketch-with-bootloader.lua /etc/arduino/base.hex
run-avrdude /etc/arduino/base.hex
8.
If you've done all the steps correctly, you should have the following output:
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.01s
avrdude: Device signature = 0x1e9587
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0xD8"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD8:
avrdude: load data hfuse data from input file 0xD8:
avrdude: input file 0xD8 contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFB"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.00s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFB:
avrdude: load data efuse data from input file 0xFB:
avrdude: input file 0xFB contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.00s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "/etc/arduino/base.hex"
avrdude: writing flash (32748 bytes):
Writing | ################################################## | 100% 8.41s
avrdude: 32748 bytes of flash written
avrdude: verifying flash memory against /etc/arduino/base.hex:
avrdude: load data flash data from input file /etc/arduino/base.hex:
avrdude: input file /etc/arduino/base.hex contains 32748 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 7.88s
avrdude: verifying ...
avrdude: 32748 bytes of flash verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
9.
Your Serial Ports should appear again now, and the TX/RX/L13 LEDs on the Yun start blinking again and your 32U4 is unbricked
Thanks very much for the help! Hope these steps will help someone else also.
Cheers.