Program Arduino Nano from Arduino Uno

Hi all,

I have an arduino nano with the USB port damaged (I cannot repair).
In order to upload the sketches i tried to use another Arduino UNO as ISP following the following links:

The problem is that i have the following error while uploading the sketch:
avrdude: stk500_getsync(): not in sync: resp=0x1c

Can someone help me? Thanks in advance.
PS: please let me know if you need more information.

This lets you program from files on an SD card:

If you don't want to do that, at least use this sketch and check on the fuses:

The examples I've seen with ArduinoISP (all?) burn the bootloader to the target.

Is it the same set up and process to upload sketches to target devices without a bootloader?
Or does boards.txt require additions for a "ATmega 328 Standalone (w/ Arduino ISP)" option?

Arduino ISP -> ICSP - Microcontrollers - Arduino Forum

Burning a bootloader and uploading a sketch are roughly the same process (the difference is where in memory they are put).

So,

  • first upload the ArduinoISP sketch to the Uno
  • connect the target (Nano) to the Uno as appropriate
  • upload the Nano's sketch, via the Uno, with Duemil./Nano as the "board"?

[Disclaimer: I have a USBtinyISP that I use for this.]

bootloader - How do I burn an ATmega328 chip via Arduino UNO as ISP? - Electrical Engineering Stack Exchange

Thanks for the answers,

This lets you program from files on an SD card:
Gammon Forum : Electronics : Microprocessors : Atmega chip stand-alone programmer to upload .hex files

Unfortunately I do not have an SD card reader...

If you don't want to do that, at least use this sketch and check on the fuses:
Gammon Forum : Electronics : Microprocessors : Sketch to detect Atmega chip types

I tried this but the output text in the console is something unreadable... What do you mean with "check on the fuses"? LFuse/HFuse/EFuse values? What can I understand from them?

However, I tried to modify the boards.txt values as stated here Arduino ISP -> ICSP - Microcontrollers - Arduino Forum; I added the row nano328.upload.using=arduino:arduinoisp, but I have the same error..

Here is the procedure I follow:

  • Uploaded the ArduinoISP to the UNO. The heartbeat led is blinking so I suppose it works.
  • Connected the cables from UNO to nano in the following way:
    UNO NANO

D13 -> D13
D12 -> D12
D11 -> D11
D10 -> RST

  • Changed IDE option to upload sketch on the NANO:
    Tools->Board->nano328
    Tools->Programmer->Arduino as ISP
  • Upload button (which gives error avrdude: stk500_getsync(): not in sync: resp=0x1c)

Do I'm making something wrong?

I don't see anything wrong that way.
There's also the "(maybe) use a 10uF cap" and/or a "120? resistor".
I don't know why there's such variation.
Maybe it's differences between genuine Arduino vs clone components or something.
I'm trying to learn here, too.

Dear all,

I solved the problem by programming the NANO with avrdude via command line as shown here: http://pdp11.byethost12.com/AVR/ArduinoAsProgrammer.htm.
Not sure about why I'm not able to do this via IDE.. Probably I have something wrong in the files like boart.txt...

However, in the following I summarize the steps I used:

  • upload ArduinoISP code to Arduino Uno
  • Connect necessary Arduino Uno pins to the Arduino Nano (see below)
  • Use avrdude via command line to upload the hex file into the NANO. (see below)

Connect Cables
UNO NANO

D13 -> D13 (SCK)
D12 -> D12 (MISO)
D11 -> D11 (MOSI)
D10 -> RST (RESET)
5V -> 5V
GND -> GND

Upload sketch with avrdude

  • Verify/compile the sketch in arduino IDE. For this I selected in the IDE Tools->Board->nano328 and Tools->Programmer->AVR ISP.

  • Check in the IDE the serial port (Tools->Serial) and the path to the generated hex. The last one appears in the IDE console going into File->Preferences and selecting Show verbose output during compilation

  • Open a terminal ane use this commands:

  1. To verify avrdude is working: avrdude -P <COM_PORT> -b 19200 -c avrisp -p m328p –n; for me <COM_PORT> = "/dev/ttyACM0"
  2. Upload hex file: avrdude -P <COM_PORT> -b 19200 -c avrisp -p m328p -u -U flash:w:"<PATH_TO_HEXD>":i; for me <PATH_TO_HEXD> ="/tmp/build1301028573051865829.tmp/led.cpp.hex"

You can solve that upload from Arduino IDE problem by creating a new board definition to boards.txt. I'm doing the same thing as you (destroyed USB port), but just using the ICSP header pins (totally equivalent to using pins 11-13, RST, +5V, GND).

http://forum.arduino.cc/index.php?topic=178517.msg1323493#msg1323493

that's the thread where a guy helped me to solve similar problem. Just notice the last two messages. You need to remove that BOARD.upload.protocol-row from the board definition block to make uploads from IDE work.

Wow, in board.txt I changed the lines as following and now it is working:

#nano328.upload.protocol=arduino
nano328.upload.maximum_size=30720
nano328.upload.speed=57600
nano328.upload.using=arduino:arduinoisp

It is pretty strange because I remember I already tried this...
Thanks everybody for the help!

If the IDE was up when you made the changes, they wouldn't take effect till the IDE got rebooted.

It would have probably worked (without the boards.txt changes) also if you had done "Upload Using Programmer" instead of just Upload.

Didn't work for me. The IDE always reverted to 56700 bps or using STK500v2 (direct upload) or then it added the "-D" parameter, no matter how much I spent time fiddling with the upload parameters (using OSX & IDE 1.0.4 & 1.0.5). After modifying the boards.txt upload works each and every time like a charm.

Hi,

this thread helped me a lot but I am trying to understand something.
I have also broken USB on nano 3.0. Was trying to burn new bootloader and sketches with UNO R3.

So I connected D13 to D13 (SCK), D12 from UNO to D11 at NANO (MISO) and D11 UNO to D12 NANO (MOSI). (GND, 5V and rst as normal).

I was getting errors all the time. I read this thread and you said to connect digital pins accordingly (12-12,11-11,13-13) so I did and it worked. So why I connected it as I assume wrongly and it works? There should be connection MOSI-MISO to have it work? Or my pinouts are different?

http://forum.arduino.cc/index.php?action=dlattach;topic=147582.0;attach=90799

ok this show different pinouts http://smartduinos.com/wp-content/uploads/2015/09/tumblr_mhwx21ePTX1s5t695o1_12801.png

so i was wrong at the beginning