USBtinyISP with Arduino Mega (ATmega1280)

by neik on Thu Feb 25, 2010 6:36 am

Hi,

I built the USBtinyISP from a adafruit kit and have been programming ATtiny2313 and ATmega328 just fine.

I am having problems burning the atmega1280 chip found on the Arduino Mega. I am using Arduino 0018 to burn a new bootloader onto the board, but I get an avrdude error:

Code: Select all
avrdude: verification error, first mismatch at byte 0x1f000
    0x0c != 0xff
avrdude: verification error; content mismatch


When I try to read the flash back it appears empty. The old bootloader is present on the board though as I can access it through the serial port.
neik
 
Posts: 6
Joined: Thu Feb 25, 2010 6:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

by adafruit on Thu Feb 25, 2010 8:58 am

eek - we never tried it. it could be that it cant program 128K of memory. it can do 64K (weve programmed '644s) yet another good reason for us to finish the next version. sorry :(
User avatar
adafruit
 
Posts: 11506
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: USBtinyISP with Arduino Mega (ATmega1280)

by jgotthardt on Thu Feb 25, 2010 12:09 pm

Hi neik and ladyada,

I have been using my USBtinyISP to program ATmega1280 and ATmega2560 chips for several months now with no problems (other than those which were self-induced).

I just tried burning the Arduino Mega bootloader to a Seeeduino Mega board (bootloader previously erased) using version 18 of the Arduino IDE. I get the same Avrdude error message, but the bootloader loads OK and I can upload sketches using the bootloader in the usual way.

Hope this helps.
John
jgotthardt
 
Posts: 31
Joined: Mon Dec 03, 2007 10:58 am
Location: Massachusetts

Re: USBtinyISP with Arduino Mega (ATmega1280)

by adafruit on Thu Feb 25, 2010 12:09 pm

oh yay! thanks jg for the very helpful post!
User avatar
adafruit
 
Posts: 11506
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: USBtinyISP with Arduino Mega (ATmega1280)

by neik on Thu Feb 25, 2010 5:48 pm

I seem to have fragged my board now. I can no longer communicate with it. The fuses and signature read back as zero and I cannot write new ones.

I'm not going to be able to come back from this am I? From looking at the circuit diagram the pins necessary for HV parallel programming aren't all brought out to headers on the board. (If I had a HV programmer!)
neik
 
Posts: 6
Joined: Thu Feb 25, 2010 6:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

by adafruit on Thu Feb 25, 2010 6:08 pm

not sure about the mega HV. one of the things we dislike is that you cant just replace the chip. however, you could try talking to it at low clock speeds. are you sure you're powering your chip properly?
User avatar
adafruit
 
Posts: 11506
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: USBtinyISP with Arduino Mega (ATmega1280)

by neik on Fri Feb 26, 2010 6:20 am

adafruit wrote:not sure about the mega HV. one of the things we dislike is that you cant just replace the chip. however, you could try talking to it at low clock speeds. are you sure you're powering your chip properly?


You are right about the removable chip: I now realise that the mega is a problem.

I've tried powering the board from the programmer, directly, and both from the same PSU. Even with -B 32 the board does not respond. It's like there is no board.

BTW I do always get this error, even when things work:

Code: Select all
         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


What does "programmer operation not supported" mean?
neik
 
Posts: 6
Joined: Thu Feb 25, 2010 6:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

by adafruit on Fri Feb 26, 2010 11:08 am

a silly avrdude error, its not important :/
User avatar
adafruit
 
Posts: 11506
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: USBtinyISP with Arduino Mega (ATmega1280)

by neik on Mon Mar 08, 2010 12:50 pm

Solved! I was comforted by the fact that the ATmega1280 has a dedicated reset pin and an SPIEN flag that cannot be reset using serial programming. I guessed it was therefore a clock problem. I got a 16MHz crystal oscillator module and injected the 16MHz into one of the crystal pins on the back of the board (the chip pins are too small), by holding a pin on it. I was then able to program the clock fuse to the correct value. I bought a proper programmer as well, to increase my chances. It was cheaper than a new Arduino Mega!
neik
 
Posts: 6
Joined: Thu Feb 25, 2010 6:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

by jsprigg on Fri Sep 10, 2010 8:53 pm

Howdy,

neik - Might I ask which programmer you bought? I intend to use the Atmega1280 in a project of mine.

Cheers!

- Jeff
jsprigg
 
Posts: 1
Joined: Fri Sep 10, 2010 8:51 pm

Re: USBtinyISP with Arduino Mega (ATmega1280)

by neik on Sat Sep 11, 2010 4:30 am

I got the proper AVR ISP MkII. It's very nice.

http://www.atmel.com/dyn/products/tools ... ol_id=3808
neik
 
Posts: 6
Joined: Thu Feb 25, 2010 6:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

by mmattice on Tue Dec 07, 2010 2:02 pm

I've run into this as well and tracked the problem down to the 16 bit integer that stores the current read address (address, defined on line 70 of main.c).
Basically, it overflows at 64kbytes, and starts reading the beginning of the chip again. If address was just one bit larger, the >> 9 later down in spi_rw (where address overflows) would turn the address into a proper word address for the read commands.

Now, this wouldn't fix 256kbyte chips as the load extended address byte command ($4d) doesn't seem to be supported at all by the USBtinyISP.

There may be a way to squeeze at least the fix for 128k chips into the tiny2313, but my compiler starts the firmware out at 8 bytes over sized before I change the type of address to uint32_t.

Mike
mmattice
 
Posts: 3
Joined: Tue Dec 07, 2010 1:51 pm

Re: USBtinyISP with Arduino Mega (ATmega1280)

by stinkbutt on Wed Dec 08, 2010 11:21 pm

mmattice wrote:I've run into this as well and tracked the problem down to the 16 bit integer that stores the current read address (address, defined on line 70 of main.c).
Basically, it overflows at 64kbytes, and starts reading the beginning of the chip again. If address was just one bit larger, the >> 9 later down in spi_rw (where address overflows) would turn the address into a proper word address for the read commands.

Now, this wouldn't fix 256kbyte chips as the load extended address byte command ($4d) doesn't seem to be supported at all by the USBtinyISP.

There may be a way to squeeze at least the fix for 128k chips into the tiny2313, but my compiler starts the firmware out at 8 bytes over sized before I change the type of address to uint32_t.

Mike


I've reviewed the code and I'm forced to concur. The USBTinyISP appears to be incapable of addressing memory addresses in excess of 64 KB, and while I can't be sure, it seems reasonable to suppose than it might brick the AVR chip if it attempts to write a nondeterministic value to the fuses, which could easily be located at address(es) 0, 1, 2, 3, etc...

Oh, actually I disagree about the line number. It's line 71, not 70.

Can anyone tell me if mmattice is wrong here?
Red M&M, Blue M&M: They all wind up the same color
stinkbutt
 
Posts: 590
Joined: Wed Feb 17, 2010 1:40 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

by jzou on Tue Jan 11, 2011 8:09 pm

I think whether it is in line70 or 71 is a matter of semantics, after all, a blank line will throw everything off, wouldn't it?

But I am very glad I found this forum. it explains away my two days of frustration.

I had this Arduino 1280 for my 4th year project that up until last week worked fine. But this week it suddenly refused to let me upload any sketches. I keep getting

avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51

so I googled around, found some suggestions that involves pushing the reset button while the code is uploading. But that did nothing for me so I researched a bit further, and found something online about the bootloader. Apparently if you insert an LED into the analog pin 13 on the arduino it is suppose to flash after you pushed the reset button, but mine didn't, which means that there is an error with my bootloader. So I found a blog posting about burning bootloader onto a Duemilinova and tried to follow that with my arduino mega, but it obviously didn't work.

My question is this, my presentation is next monday, the 17th, is there any quick fixes that I can use to fix this? If so, how do I do this?

Thanks everyone
jzou
 
Posts: 1
Joined: Tue Jan 11, 2011 7:28 pm

Re: USBtinyISP with Arduino Mega (ATmega1280)

by adafruit on Tue Jan 11, 2011 9:53 pm

what does your question have to do with a usbtinyisp?
User avatar
adafruit
 
Posts: 11506
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc