Issues burning the ATMegaBOOT on a mega128

USB AVR Programmer and SPI interface. Adafruit's USBtinyISP.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Issues burning the ATMegaBOOT on a mega128

Post by xsmurf »

&tHello, I know this may, or may not, be a little off topic but I'm really not sure where too look. If you have a better idea feel free to turn me around ;)

I just bought a ET-AVR Stamp (basically a mega128 on a breaboard compatible pcb) from futurlec. So I compiled the ATMegaBOOT (the one from the arduino to be exact) for the mega128. That was easy enough. But that's where the "fun" began. Burning seemed to go fine, except that at the end I get this:

Code: Select all

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1e000
         0x0c != 0xff
avrdude: verification error; content mismatch

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

make: *** [isp] Error 1 
Same thing happens whether I self power the device or use an external wallwart.

(I have the .text section set at 0x1E000 as per the original ATMegaBOOT).

When I use UISP to read back the fuses (couldn't get that to work from avrdude) this is what I get:

Code: Select all

$ uisp -dprog=stk500 -dserial=/dev/tty.usbmodem0020121D1 -dspeed=9600 -dpart=atmega128 --rd_fusesFirmware Version: 1.16
Atmel AVR ATmega128 is found.
Firmware Version: 1.16

Fuse Low Byte      = 0x00
Fuse High Byte     = 0x00
Fuse Extended Byte = 0x00
Calibration Byte   = 0x00  --  Read Only
Lock Bits          = 0x00
    BLB12 -> 0
    BLB11 -> 0
    BLB02 -> 0
    BLB01 -; 0
      LB2 -> 0
      LB1 -> 0 
(Yes I changed the bootloader's speed to 9600 see if that would help... I really don't think it did change anything)

I'm really all out of ideas :/ What am I doing wrong?

Thanks

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

Post by adafruit »

are you using a usbtinyisp to program the chip?

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

Of course! I also tried burning the program using the usbtiny (it was compiled in Wiring).


EDIT: I have a similar thread on the Arduino forum, but to be honest I thought maybe you'd have some insight about this and the USBTiny interaction. In fact one of the problem is I can't get to read the fuse from avrdude (gives an error saying the file type is wrong when I do something like -U hfuse:r:high.txt). I also can't use uisp because, afaik, usbtiny doesn't support it. And the bootloader can't read back the fuses either.

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

Post by adafruit »

-U hfuse:r:high.hex:i maybe?

usbtiny supports whatever avrdude supports wrt reading fuses, so it sounds like reading the fuse, at least, is an avrdude issue not a usbtiny issue

bootloaders cant read their own fuses, often times

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

yeap that worked :) thanks. I compiled a small binary from AVR Studio (hooray to Wine) and it seemed to have worked. But it looked like it overwrote the bootloader (the program would load right away). But now when I try to burn the bootloader again I get the dreaded "avrdude: initialization failed, rc=-1" error. I tried self powered, wallwart powered and various configuration for the order in which I plugged the power, icsp and usb.

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

I also tried cutting the bus power trace. Same error :S

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

Post by adafruit »

well if it worked once, its probably your wiring, crystal, timing, chip, etc...

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

Ok so I ordered a new m128 board (10pin isp) and it finally arrived. Before doing anything, I tried to read the fuse like:
$ avrdude -c usbtiny -p m128 -U hfuse:r:high.hex:i -U lfuse:r:low:low.hex:i -U efuse:r:ext.hex:i
and I did the same on the arduino... but with the same result in both cases
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

EDIT: I also tried with sudo, but to no avail.

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

Ok so I just realized that I had soldered the 10 pin header the wrong way :oops:

But now I'm getting the same thing. My guess is this may have fried an IO port on the tiny2313. However I have some fresh ones laying around. I'll see if I can load the Arduino boot cloner with the USBTiny's hex file and fuses.

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

After my failed attempts to use the Arduino as a programmer, I ended up buying another pre-programmed t2313. Sadly, that's also a no go!

Code: Select all

$ avrdude -c usbtiny -pm168

avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.
Same goes for the m128 board. In either self powered, programmer powered or powered from programmed board configurations.

Now I'm really out of ideas :'(

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

Just wanted to say I tried with -F and it doesn't give the expected result either...

Code: Select all

Chimera:applet mlalonde$ avrdude -F -c usbtiny -pm168 -U hfuse:r:hfuse.hex:i

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

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: reading hfuse memory:

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

avrdude: writing output file "hfuse.hex"

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Chimera:applet mlalonde$ cat hfuse.hex 
:0100000000FF
:00000001FF
Chimera:applet mlalonde$ avrdude -F -c usbtiny -pm168 -U lfuse:r:lfuse.hex:i

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

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
avrdude: Expected signature for ATMEGA168 is 1E 94 06
avrdude: reading lfuse memory:

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

avrdude: writing output file "lfuse.hex"

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

Chimera:applet mlalonde$ cat lfuse.hex 
:0100000000FF
:00000001FF

xsmurf
 
Posts: 28
Joined: Mon Aug 27, 2007 3:04 pm

Post by xsmurf »

Oh yeah, here's a more detailed output. I also tried recompiling avrdude from version 5.5 (which has built in support for the usbtiny) and note that I'm running 10.5

Code: Select all

Chimera:avrdude-5.5 mlalonde$ ./avrdude -c usbtiny -p t2313 -v -v -v

avrdude: Version 5.5, compiled on Dec 16 2007 at 16:15:39
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

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

         Using Port            : unknown
         Using Programmer      : usbtiny
         AVR Part              : ATtiny2313
         Chip Erase delay      : 9000 us
         PAGEL                 : PD4
         BS2                   : PD6
         RESET disposition     : possible i/o
         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     6     4    0 no        128    4      0  4000  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6    32    0 yes      2048   32     64  4500  4500 0xff 0xff
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           calibration    0     0     0    0 no          2    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
CMD: [ac 53 00 00] [ac 53 00 00]
CMD: [ac 53 00 00] [00 00 00 00]
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.


avrdude done.  Thank you.

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

Post by adafruit »

if you're trying to program a '2313 and you're getting "rc=-1" then 99% of the time its a clocking/wiring/power problem...are you sure its wired up right?
:(

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

Return to “USBtinyISP”