initialization failed, rc=1

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
centerblack
 
Posts: 5
Joined: Thu Nov 06, 2008 7:42 pm

initialization failed, rc=1

Post by centerblack »

[EDIT: This issue was resolved, scroll down for more info about serial programming pins on the ATMega128 / 1281]
Hi,

I'm trying to flash an ATMega1281 with my usbtiny. I know the programmer works because I'm using it with an atmega644 as well. I get the

Code: Select all

avrdude: initialization failed, rc=-1
when trying to flash the 1281. The chip is getting 5V, and I've checked that the programmer is correctly connected to mosi/miso/reset/sck/vcc/gnd....

Anyone have some general/common troubleshooting tips that might help me figure out what's wrong?

Thanks!
Matt

edit: more info,
reset is idling high, it goes low when I try to flash the chip, I also see activity on mosi/miso/sck when attempting to flash.

Code: Select all

 $ avrdude -p atmega1281 -c usbtiny -v

avrdude: Version 5.5, compiled on Jul 21 2008 at 19:43:37
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

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

         Using Port            : unknown
         Using Programmer      : usbtiny
         AVR Part              : ATMEGA1281
         Chip Erase delay      : 9000 us
         PAGEL                 : PD7
         BS2                   : PA0
         RESET disposition     : dedicated
         RETRY pulse           : SCK
         serial program mode   : yes
         parallel program mode : yes
         Timeout               : 200
         StabDelay             : 100
         CmdexeDelay           : 25
         SyncLoops             : 32
         ByteDelay             : 0
         PollIndex             : 3
         PollValue             : 0x53
         Memory Detail         :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
           flash         65    10   256    0 yes    131072  256    512  4500  4500 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : USBtiny
         Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude: programmer operation not supported

avrdude: Using SCK period of 10 usec
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
Last edited by centerblack on Fri Nov 07, 2008 1:33 am, edited 1 time in total.

centerblack
 
Posts: 5
Joined: Thu Nov 06, 2008 7:42 pm

Re: initialization failed, rc=1

Post by centerblack »

Referencing this forum post where some people were trouble shooting a TVBgone kit:http://www.ladyada.net/forums/viewtopic ... ht=connect

I followed BANNED's instructions on testing MOSI/MISO, which appear to be working correctly.

Code: Select all

$ avrdude -c usbtiny -p atmega1281 -Ft

avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA1281 is 1E 97 04
avrdude> send 0x12 0x34 0x56 0x78
>>> send 0x12 0x34 0x56 0x78 
results: ff ff ff ff

avrdude> send 0x12 0x34 0x56 0x78
>>> send 0x12 0x34 0x56 0x78 
results: 00 00 00 00

avrdude> send 0x12 0x34 0x56 0x78
>>> send 0x12 0x34 0x56 0x78 
results: 12 34 56 78

avrdude> 
Also, I haven't changed the fuses on the 1281. I do have a 16MHz oscillator connected to xtal1/2 as well as 22pF caps to gnd. I was planning on using these fuse settings (-U hfuse:w:0x99:m -U lfuse:w:0x4E:m) but I don't want to brick the chip since I'm still not sure why I can't initialize the chip.

centerblack
 
Posts: 5
Joined: Thu Nov 06, 2008 7:42 pm

Re: initialization failed, rc=1

Post by centerblack »

Using -B 250

Is MISO abnormal?

SCK:
Image

MISO:
Image

MOSI:
Image

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

Re: initialization failed, rc=1

Post by adafruit »

http://www.ladyada.net/library/ucannoya ... mming_pins

dunno if the 1281 is like the 128 but its a start...

centerblack
 
Posts: 5
Joined: Thu Nov 06, 2008 7:42 pm

Re: initialization failed, rc=1

Post by centerblack »

Wow. You're awesome. Thank you so so so so much for that link.

The 1281 is designed to be pin compatible with the ATMega128. I just checked the datasheet and it _does_ share this quirk for serial programming.
e.g. The programmer shouldn't be connected to the marked MOSI/MISO pins, instead they get connected to PE0 and PE1 respectively...

I connected some jumpers on my PCB, fired up avrdude and was able to flash the chip, no problem! Thank you so much, I've been crazy stressed out over this for like two days!

Locked
Please be positive and constructive with your questions and comments.

Return to “Microcontrollers”