Okay guys SOLVED the problem!! ![]()
How did I do it?
-
Prepare arduino UNO board as ISP programmer as shown on the tutorial. Note that I did not have a capacitor on GND and RESET. This programmer was on COM4.
-
erased the whole chip memory (the chip 32u4 on the arduino robot) with -F command. Here is my avrdude code:
avrdude -C"C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -v -v -v -patmega32u4 -carduino -B 8 -P\.\COM4 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0xcb:m -Uhfuse:w:0xd8:m -Ulfuse:w:0xff:m -F
Note: the -F was necessary because I was getting device signature errors. However, be very careful when using -F as this might lock up some fuses and make things even harder!
- uploaded another example sketch (actually a hex file compiled by the IDE) with -F. here is the code:
avrdude -C"C:\Program Files (x86)\Arduino\hardware\tools\avr\etc\avrdude.conf" -v -v -v -v -patmega32u4 -carduino -P\.\COM4 -b19200 -Uflash:w:C:\Users\XCOM\AppData\Local\Temp\build4730142799873281839.tmp_333.cpp.hex:i -F
A couple seconds of reset... aaaand it works!
I can then upload the good old bootloader so everything back to normal, phew!
anyway, thanks everyone for reading this!