USBtinyISP with Arduino Mega (ATmega1280)

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

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
neik
 
Posts: 6
Joined: Thu Feb 25, 2010 7:28 am

USBtinyISP with Arduino Mega (ATmega1280)

Post by neik »

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.

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

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by adafruit »

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
jgotthardt
 
Posts: 33
Joined: Mon Dec 03, 2007 11:58 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by jgotthardt »

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.

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

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by adafruit »

oh yay! thanks jg for the very helpful post!

neik
 
Posts: 6
Joined: Thu Feb 25, 2010 7:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by neik »

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!)

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

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by adafruit »

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?

neik
 
Posts: 6
Joined: Thu Feb 25, 2010 7:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by neik »

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?

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

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by adafruit »

a silly avrdude error, its not important :/

neik
 
Posts: 6
Joined: Thu Feb 25, 2010 7:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by neik »

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!

jsprigg
 
Posts: 1
Joined: Fri Sep 10, 2010 9:51 pm

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by jsprigg »

Howdy,

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

Cheers!

- Jeff

neik
 
Posts: 6
Joined: Thu Feb 25, 2010 7:28 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by neik »

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

http://www.atmel.com/dyn/products/tools ... ol_id=3808

User avatar
mmattice
 
Posts: 3
Joined: Tue Dec 07, 2010 2:51 pm

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by mmattice »

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

User avatar
stinkbutt
 
Posts: 593
Joined: Wed Feb 17, 2010 2:40 am

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by stinkbutt »

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?

jzou
 
Posts: 1
Joined: Tue Jan 11, 2011 8:28 pm

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by jzou »

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

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

Re: USBtinyISP with Arduino Mega (ATmega1280)

Post by adafruit »

what does your question have to do with a usbtinyisp?

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

Return to “USBtinyISP”