Go Down

Topic: Program Arduino Nano from Arduino Uno (Read 5684 times) previous topic - next topic

freidkry

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:
  - http://arduino.cc/en/Tutorial/ArduinoISP
  - http://wirejungle.wordpress.com/2010/08/16/programming-arduino-with-arduino/

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.

Nick Gammon

This lets you program from files on an SD card:

http://www.gammon.com.au/forum/?id=11638

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

http://www.gammon.com.au/forum/?id=11633
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Runaway Pancake

#2
Jul 21, 2013, 02:05 am Last Edit: Jul 21, 2013, 02:07 am by Runaway Pancake Reason: 1
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?

> > > http://forum.arduino.cc/index.php?topic=178517.0
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

Nick Gammon

Burning a bootloader and uploading a sketch are roughly the same process (the difference is where in memory they are put).
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Runaway Pancake

#4
Jul 21, 2013, 02:14 am Last Edit: Jul 21, 2013, 02:18 am by Runaway Pancake Reason: 1
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.]

> > > http://electronics.stackexchange.com/questions/10587/how-to-burn-atmega328-chip-via-arduino-uno-as-isp
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

freidkry

Thanks for the answers,

Quote
This lets you program from files on an SD card:
http://www.gammon.com.au/forum/?id=11638


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

Quote
If you don't want to do that, at least use this sketch and check on the fuses:
http://www.gammon.com.au/forum/?id=11633


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 http://forum.arduino.cc/index.php?topic=178517.0; 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?
   

Runaway Pancake

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.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

freidkry

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"


androidi

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.
"Interface is everything."  -- Androidi Ltd.

freidkry

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

#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!

Runaway Pancake

If the IDE was up when you made the changes, they wouldn't take effect till the IDE got rebooted.
"Who is like unto the beast? who is able to make war with him?"
When all else fails, check your wiring!

hiduino

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


androidi

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.
"Interface is everything."  -- Androidi Ltd.

terragady

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
https://raw.githubusercontent.com/wiki/NicoHood/HoodLoader2/pictures/pinout.png

terragady

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

so i was wrong at the beginning

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy