📣📪 🚚 Adafruit will not be shipping USPS orders Monday October 14, 2019 🗓. Expedited USPS orders placed after 11am ET 🕚 Friday October 11 will go out Tuesday October 15 📣📪🚚
0

AVR m168 Arduino and AVRISPmkII
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

AVR m168 Arduino and AVRISPmkII

by dioioib on Tue Dec 18, 2007 11:53 pm

I have no idea why this is no longer working for me. I don't think i changed anything in my setup, but I am now unable to write to avr's using my ISP programmer. I have tried reinstalling the Software on both my laptop and my desktop and still nothing. Any suggestions?
dioioib
 
Posts: 10
Joined: Mon Dec 17, 2007 1:08 am
Location: Canada

I have resolved some of the problem

by dioioib on Wed Dec 19, 2007 12:04 am

now this is my output

Code: Select all | TOGGLE FULL SIZE
harp1:~ briandurocher$ sudo avrdude -p m168 -P usb:0000B0005522 -c avrispmkII -e
avrdude: stk500v2_getsync(): error communicating with programmer: (0)

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.10s

avrdude: Device signature = 0x1e9406
avrdude: erasing chip

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

harp1:~ briandurocher$ sudo avrdude -p atmega168 -b 19200 -P usb -c avrispmkII -U lock:w:0x3F:m -U hfuse:w:0xDF:m -U lfuse:w:0xFF:m -U efuse:w:0x0:m -U flash:w:chAtmega8Gong.hex
Password:
avrdude: stk500v2_getsync(): error communicating with programmer: (0)

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.11s

avrdude: Device signature = 0x1e9406
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 "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.04s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.03s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.04s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.10s

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.03s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: reading input file "0x0"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.11s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x0:
avrdude: load data efuse data from input file 0x0:
avrdude: input file 0x0 contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.04s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "chAtmega8Gong.hex"

avrdude: safemode: Fuses OK

avrdude done.  Thank you.



but it takes forever to load into the AVR like 10 minutes before it does anything at all.[/code]
dioioib
 
Posts: 10
Joined: Mon Dec 17, 2007 1:08 am
Location: Canada

by adafruit on Wed Dec 19, 2007 12:30 am

er...the output seems to imply everythings working fine...?

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm
Location: nyc

by dioioib on Wed Dec 19, 2007 2:31 am

It working after a reinstall but it hangs for 10 minutes before upload...
dioioib
 
Posts: 10
Joined: Mon Dec 17, 2007 1:08 am
Location: Canada

by none_such on Tue Jan 22, 2008 3:57 am

maybe some info on your hardware/software setup would be helpful since you report a hangtime problem - kernel version, etc. - this would aid in seeing if anyone else has a similar problem with avrdude.

none_such
 
Posts: 76
Joined: Mon Jun 12, 2006 1:16 pm

OS X

by none_such on Tue Jan 22, 2008 4:17 am

here is something I found to solve the problem for OS X
..........................
Then I ran the following from the Terminal to erase, unlock, and set its fuses:


avrdude -e -c avrispmkII -p m8 -P usb -b 115200 -U lock:w:0x3f:m -U hfuse:w:0xca:m -U lfuse:w:0xdf:m

This resulted in a long hang, during which the USB activity LED on the MkII blinked about every 15 seconds, indicating that something was happening (albeit very slowly). After several minutes it eventually started working and seemed to mostly work fine. The one problem I could see, causing the hang time, is apparently well known and normal when using a MkII on OS X with AVRDUDE:

avrdude: stk500v2_getsync(): error communicating with programmer: (0)

So I did a search on the error message and came across a nice post here discussing a workaround. Since it was a “normal” error for my particular setup, and since it made the programming take so long, I decided to get around it in a slightly different way.

I changed the source code in AVRDUDE’s stk500v2.c file, starting at line 549, from:

Code: Select all | TOGGLE FULL SIZE
if (tries > 33) {
fprintf(stderr,"%s: stk500v2_getsync(): error communicating with programmer: (%d)\n",
progname,status);
} else
goto retry;

to:
Code: Select all | TOGGLE FULL SIZE
fprintf(stderr,"%s: found AVRISP mkII programmer\n", progname);

Then, I ran ./configure, make, and sudo make install again and continued burning the bootloader onto the chip:


cd /Applications/arduino-0007/bootloader/
avrdude -c avrispmkII -p m8 -P usb -b 115200 -D -U flash:w:ATmegaBOOT.hex:i

The hang time disappeared, and the error message was replaced with:

avrdude: found AVRISP mkII programmer

Hooray! The MkII LED blinked red (supposedly indicating a short circuit?), but remained responsive when I finally locked the bootloader:

avrdude -c avrispmkII -p m8 -P usb -b 115200 -U lock:w:0x0f:m

The pin 13 LED on the Arduino blinked steadily, a default program, indicating that the bootloader was installed successfully.

If you are in the same boat, but don’t want to manually replace things in the stk500v2.c file, you can simply replace the default file with this one .

none_such
 
Posts: 76
Joined: Mon Jun 12, 2006 1:16 pm

by dioioib on Sat Jul 05, 2008 9:51 pm

sounds great I am going to give this a shot.
dioioib
 
Posts: 10
Joined: Mon Dec 17, 2007 1:08 am
Location: Canada

by boardhead on Thu Oct 02, 2008 11:33 am

Thanks!! I wasted a lot of time on this one, but it works now after applying your patch! I wish they would patch avrdude to fix this bug on OS X, because everything else seems to work properly. Before the patch, it would hang for a couple of minutes each time I ran avrdude. ie)

Code: Select all | TOGGLE FULL SIZE
> sudo avrdude -c avrispmkII -P usb -p usb1287 -v -v -t

avrdude: Version 5.5, compiled on Oct  2 2008 at 10:56:06
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "/usr/local/etc/avrdude.conf"
         User configuration file is "/Users/phil/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port            : usb
         Using Programmer      : avrispmkII
avrdude: usbdev_open(): Found AVRISP mkII, serno: 0000B0039007
[wait a couple of minutes here]
avrdude: stk500v2_getsync(): error communicating with programmer: (0)
boardhead
 
Posts: 1
Joined: Thu Oct 02, 2008 11:28 am

Please be positive and constructive with your questions and comments.