Go Down

Topic: Problem using ISP-programmer in Arduino IDE (Read 5417 times) previous topic - next topic

MHz

I'm quite sure my minimal bredboard setup - just the ATmega328, the quartz, two 22p Cs, a LED and a correct
wired ISP socket is working. I have tested this with my STK500 clone in AVR studio 4 by downloading a .hex
file (actual the Arduino Blink example). AVR Studio reports no error, LED is blinking!
Studio reads the  following Fuse / Lock bits:
ext 0xFD
high 0xDA
low 0xFF
all Lock bits set to no
This seems to be the correcht settings. There is no bootloader burned. To my understandig this is not necessary while using an ISP programmer.

Switching over to Arduino I first set upload.using=avrisp in preferences.txt file. There after I started Arduino IDE and start a verbose upload. Here is what I get (btw: board was set to Ard. Duem. / Nano w. ATmega328  port was set to 5 as in AVR studio)

avedude v5.4
using port com5
using programmer stk500v1
ser_open: setting dtr
sent: 0
  • [20]    (3 times)
    recv:               (blank)
    stk500_getsync(): not in sync: resp=0x00
    send: Q [51] [20]
    recv:               (blank)
    stk500_disable() protocol error, expected 0x14 resp=0x51
    avrdude done. Thank you.  :P

    Can someone interpret this protocol and give me a hint what do I have to change to make it running?
    Is anyone out there who has managed to use an STK500 compliant programmer in Arduino IDE? How???

    Thank you for any hint!

bubulindo

I may be wrong, but does the Arduino burn programs in the chips? Or just tries to download through the bootloader?
Or are you trying to burn the bootloader onto the chip?

What puzzles me, is this message:

ser_open: setting dtr

If you are burning the chip, DTR isn't needed. But it's just a guess.
This... is a hobby.

westfw

Quote
I first set upload.using=avrisp in preferences.txt file. There after I started Arduino IDE and start a verbose upload.
  :
avrdude v5.4
using port com5
using programmer stk500v1

What is the avrdude command line shown ?  It looks to me like it is NOT using avrisp as the upload protocol.  I think you need to change boards.txt (xxx.upload.protocol ?) rather than just the preferences.txt file.

MHz

Thanks westfw.
The avrdude command line reads:
...hardware/tools/avr/etc/avrdude.conf -v -v -v -v -ptmega328p -cstk500v1 -P

Changing boards.txt in ...\hardware\arduino to:

atmega328.name=Arduino Duemilanove or Nano w/ ATmega328
atmega328.upload.protocol=avrisp  <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
atmega328.upload.maximum_size=30720
atmega328.upload.speed=57600

doesn't change anything  =(

Lost in Arduinos file-preferencees-setup-you-name-it file jungle
Thanks MHz

bubulindo

This... is a hobby.

westfw

Quote
doesn't change anything

Hmm.  It worked OK for me.  Did you quit the IDE before changing the boards.txt file?  It only reads it at startup, I think.

Binary sketch size: 1018 bytes (of a 32256 byte maximum)
D:\bin\arduino-0022\hardware/tools/avr/bin/avrdude -CD:\bin\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cavrisp -P\\.\COM1 -b115200 -D -Uflash:w:C:\DOCUME~1\billw\LOCALS~1\Temp\build8330633795479567026.tmp\Blink.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "D:\bin\arduino-0022\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : \\.\COM1
         Using Programmer      : avrisp
         Overriding Baud Rate  : 115200

MHz

@ bubulindo: avrdude by it self? A lot of confusing parameters. At least for a newbee as me. The fine thing of an IDE is you shouldn't care about. Thank you for the hint. May be you can supply me a simple how-to-do

@ westfw: Yes I quit the IDE before making the changes and restart. With your protocol at hand I tried the following:
1 changing boards.txt: from upload.protocol=stk500 to =avrisp
  - nothing changed
2 changing programmers.txt:  avrisp.protocol=stk500v1 to avrisp
  - yippee! avrdude protokoll changed to -cavrisp But still can't get in sync
3 changing programmers.txt: avrisp.communication=serial to =usb
  - system can not find the file
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Binary sketch size: 1018 bytes (of a 30720 byte maximum)
D:\arduino-0022\arduino-0022\hardware/tools/avr/bin/avrdude -CD:\arduino-0022\arduino-0022\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega328p -cavrisp -Pusb -Uflash:w:C:\DOKUME~1\Jochen\LOKALE~1\Temp\build8606223222258895988.tmp\Blink0_5.cpp.hex:i

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "D:\arduino-0022\arduino-0022\hardware/tools/avr/etc/avrdude.conf"

         Using Port            : usb
         Using Programmer      : avrisp
avrdude: ser_open(): can't open device "usb": Das System kann die angegebene Datei nicht finden.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
:0   :0    :0

Thank you for all your patience westfw.

Uploading whith ISP works as your experience shows. Whats wrong whith my settings?

still confident MHz

bubulindo

I do not know German (or Germanic languages), but this:

Quote
avrdude: ser_open(): can't open device "usb": Das System kann die angegebene Datei nicht finden.


makes me believe either you have your serial port open, or your serial port doesn't exist. Which one do you think it may be? Are you running Windows, Linux?

About the avrdude, there's plenty of examples to be used together with the AVR-GCC... you'll need to get a sample Makefile and take it from there. AVR-GCC brings example makefiles too. So, although not easy, it's perfectly possible to get it done.
This... is a hobby.

MHz

Hi Westfl,
hi everybody who can help,
still can't upload from within Arduino IDE to a bare e.g whithout a booloader mega328 chip BUT playing around with standalone avrdude - there is a nice GUI on the net - I figure out arduino uses avrdude V5.4 (V5.10 is the current version). In this version there is no support for the mega328 chip - arduino must use a spcial trick  :~  Happily the GUI generate and show the avrdude command lines and let you edit them. So I used your avrdude protocol as a guideline and had success! Avrdude load the .hex file generated by arduino (hard to find). Finaly my program runs on the bare bone chip  :)

Qustion now what is wong whith my settings. May I ask you sending me a copy of your ...programmers-   ...boards- ...avrdude.config-files and what ever ma bee importand.

Thank you for your patience and advice
MHz

BTW: V5.10 needs a .dll I don't have on my XP system

westfw

Quote
Qustion now what is wong whith my settings. May I ask you sending me a copy of your ...programmers-   ...boards- ...avrdude.config-files and what ever ma bee importand.

hmm.  The truth is that I've never used the Arduino IDE to program the bootloader; I always used either the optiboot sourcecode route ("make atmega328_isp") (with the avrdude included with Arduino) or the optisketch stand-alone program...

mariusl

It is a bit late but for the sake of knowing. I found this little tool called ARP / Arduino Uploader. Very simple and precisely what is needed to burn a file to ATmega chips.

Rather people think you to be a fool than you open your mouth and confirm it.

MHz

Thank you Marius for the hint. Calling avrdude under my own control (bypassing Arduino IDE) is enlightning. I found the avrdude-gui very usefull. It gives you full control over all the (confusing but never the less importand) parameters. To solve my problem I ended up with an own programmer and board definition.
for your convenience I attach the avrdude-gui-zip
Have fun!


Go Up