Cheapest choice of ISP programming tool for ATMEGA2561

Go To Last Post
16 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, 

I have made some customs PCBs with ISP headers for programming with AS7. With the  USBtiny ISP(ebay clone) I have successfully programmed the atmega328's but NOT the atmega2561. I found out that this happens because of its large flash memory(256KMB). If this is correct, could you propose me other cheap solution? (below 50$)

 

Thank you

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The size of the flash should make no difference. Are you using a very old version of software to drive the USBtiny ISP on the PC? If you simply get a $2 USBAsp from ebay and drive it with avrdude there should be no issue with programming 256K devices.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried to program an arduino MEGA(atmega2560) and works fine. As concerning the drivers I reinstall the newest version I found. But I still can't program the atmega2561. I checked the connections, no shortcuts, everything is ok. 

 

-Are there NECESSARY passive components for uC to just blink a LED?

 

-the output from avrdude is:

 

avrdude.exe: Version 6.3, compiled on Feb 17 2016 at 09:25:53
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\avrdude-6.3-mingw32\avrdude.conf"

             Using Port                    : usb
             Using Programmer              : usbtiny
avrdude.exe: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
             AVR Part                      : ATmega2561
             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
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               flash         65    10   256    0 yes    262144  256   1024  4500  4500 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
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               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
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                      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

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

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

avrdude.exe done.  Thank you.

 

 

 

//------------------After using -F:  

avrdude.exe: initialization failed, rc=-1
avrdude.exe: AVR device initialized and ready to accept instructions
avrdude.exe: Device signature = 0x000000 (retrying)
avrdude.exe: Device signature = 0x000000 (retrying)
avrdude.exe: Device signature = 0x000000
avrdude.exe: Yikes!  Invalid device signature.
avrdude.exe: Expected signature for ATmega2561 is 1E 98 02
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.

avrdude.exe done.  Thank you.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

NEVER use the -F option, NEVER! 

 

n.kotso1 wrote:
-Are there NECESSARY passive components for uC to just blink a LED?

 

Yes, all VCC/GND and AVCC/GND pairs must be powered and have 100nf Caps connected as close to the pins as possible.

Until you can read the signature of the chip, go no further, some thing is not connected or powered correctly.

 

Jim

Mission: Improving the readiness of hams world wide : flinthillsradioinc.com

Interests: Ham Radio, Solar power, futures & currency trading - whats yours?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok, if there are caps  a little less than 1cm far from uC, all 6 ISP pins are connected properly and RESET pin is with 10K pullup resistor, is there anyrhing else I can try?

 

Should I conclude then  that I damaged the uC from soldering?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The size of the flash should make no difference.

 Some programmers only use a 16bit value for "destination address" and have trouble at the 64k limit (sometimes bytes, sometimes words.)

Sometimes host-side software can compensate using "raw SPI command" type features to do the "load extended address byte", but not always.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Unless you used a blowtorch, it is unlikely that you damaged the chip. I’d suggest you check the wiring and ensure you’ve used the correct pins for programming - check the datasheet. The usual error is to use the mosi and miso pins like you would with a mega328.

 

Refer to 30.8.1 in the datasheet.

Last Edited: Mon. Apr 23, 2018 - 10:53 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:

The usual error is to use the mosi and miso pins like you would with a mega328.

 

Exactly what I did! 

 

The correct pins is PD1(PE0) and PD0(PE1) instead of MOSI(PB2) and MISO(PB3). 

 

Now, if the MOSI pin from USBtiny goes to both PE0 and PB2 is there gonna be a problem? (Only for programming. As I said its a custom PCB.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

n.kotso1 wrote:

Kartman wrote:

The usual error is to use the mosi and miso pins like you would with a mega328.

 

Exactly what I did! 

 

The correct pins is PD1(PE0) and PD0(PE1) instead of MOSI(PB2) and MISO(PB3). 

 

Now, if the MOSI pin from USBtiny goes to both PE0 and PB2 is there gonna be a problem? (Only for programming. As I said its a custom PCB.)

Go on.   Pee-Dee-Eye is different to Pee-Dee-One.   And Pee-Dee-Oh is different to Pee-Dee-Zero.

If you do not distinguish between letters and digits life becomes confusing.   Especially when PD1 by convention means PORTD.1

 

The letter acronyms mean ProgramDataIn,  ProgramDataOut,  MasterOutSlaveIn, MasterInSlaveOut.

 

It is confusing enough for English speakers.    It must be difficult for non-English speakers.

 

Your 3x2 ISP header is wired to PE0, PE1 i.e. the programming pins.

You do not connect them to the SPI pins on this style of TQFP-64 chip.

 

Arduino-style boards use the 3x2 ISP header for both ISP and SPI e.g. mega328, mega32u4, mega2560, ...

 

David.

Last Edited: Tue. Apr 24, 2018 - 09:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Cheapest" solution is a very ambigous term since USD 2 programmers from Ebay / Ali are common.

AVRdude supports direct bit banging on GPIO ports from systems with GPIO pins (or the good old fashioned LPT port).

This is how I built my first (AN910) programmer a long time ago (before avrdude existed).

 

A "modern" example of an almost zero hardware cost of such a board is:

https://hackaday.io/project/8143-avr-programmer-for-raspberry-pi

https://hackaday.io/project/8143/gallery#46fbe2803ba3685dd554583388d03098

 

You say you have problems with the atmega2561. Does this chip use the standard SPI interface for programming or does it use one of the other "more modern" interfaces?

I have only used AVR's which are compatible with the USBap software myself.

 

Intel Hex files are limited to 64kB address space. If you go over that, then there is a workaround in the Intel Hex format for "address records" to do something similar to bank switching. It could be that this leads to problems if a part of your software chain does not support this properly.

A possible workaround is to use the Motorola Srecord file format or binary format to send files to your programmer.

The largest unknown seems to be your USBtinyisp programmer. You could try some other firmware for it or use an USBasp (based on atmega8).

 

The "official" Atmel-ICE PCB (with components) fits your USD 50 budget. It costs USD 40 (exclusive shipping) from Microchip:

https://www.microchipdirect.com/product/search/all/ATATMEL-ICE

(Compared with this, the addition of a plastic housing and a few cables are pretty expensive, especially because the cables seem to be flimsy).

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just had a peek at a usbtinyisp manual:

https://cdn-learn.adafruit.com/downloads/pdf/usbtinyisp.pdf

And it literary says that it is not compatible with AVR's with > 64kB Flash.

What chips can be programmed?
Any AVR that uses the ISP interface for programming and has 64K or less of flash can be programmed.
Chips such as the Atmega1280/1281 and Atmega2560/2561 have more than 64K and cannot be programmed.

 

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Which is why I said in #2 that you can't really go wrong with avrdude+USBAsp as they have no such limit (and cost the same $2 on ebay as USBTinyISP do).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did not see the package you are using for this; however, the datasheet indicates:

 

Depending on whether you have the 100-pin or 64-pin TQFP you select the appropriate pins.

Also pay close attention to Note 2 above.

 

Edit: which you apparently spotted yourself in post #8...blush

Edit2:    Especially since the 2561 is 64-pin only... DOH!

 

David (aka frog_jr)

Last Edited: Tue. Apr 24, 2018 - 05:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The 64-pin packages use PE0, PE1

The 100-pin packages use PB2, PB3

 

The 2561 is the 64-pin version of the 100-pin 2560.

 

The old 103, 64, 128 64-pin packages also used PE0, PE1.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:
... or binary format to send files to your programmer.
or ELF that's after binary (little endian) in the AVRDUDE 6.3 manual.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please check blow.

 

https://www.avrfreaks.net/forum/...