Go Down

Topic: Trouble burning bootloader to Atmega2561 (Read 6664 times) previous topic - next topic

CrossRoads

Feb 20, 2016, 09:39 pm Last Edit: Feb 20, 2016, 09:55 pm by CrossRoads
I've got a couple Atmega2561 boards assembled now, but  I can't get them bootloaded.
I get this error message
Code: [Select]

C:\Arduino\hardware/tools/avr/bin/avrdude -CC:\Arduino\hardware/tools/avr/etc/avrdude.conf -v -v -v -v -patmega2561 -cstk500v2 -Pusb -e -Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xD8:m -Ulfuse:w:0xFF:m

avrdude: Version 5.11, compiled on Sep  2 2011 at 19:38:36
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "C:\Arduino\hardware/tools/avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : stk500v2
avrdude: usbdev_open(): Found AVRISP mkII, serno: 000200097044
avrdude: usbdev_open(): using read endpoint 0x82
avrdude: Sent: . [01]
avrdude: Recv: . [01] . [00] . [0a] A [41] V [56] R [52] I [49] S [53] P [50] _ [5f] M [4d] K [4b] 2 [32]
avrdude: stk500v2_getsync(): found AVRISP mkII programmer
         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 : STK500V2
         Description     : Atmel STK500 Version 2.x firmware
         Programmer Model: AVRISP mkII
avrdude: Sent: . [03] . [90]
avrdude: Recv: . [03] . [00] . [01]
avrdude: Sent: . [03] . [91]
avrdude: Recv: . [03] . [00] . [01]
avrdude: Sent: . [03] . [92]
avrdude: Recv: . [03] . [00] . [11]
         Hardware Version: 1
         Firmware Version Master : 1.17
avrdude: Sent: . [03] . [94]
avrdude: Recv: . [03] . [00] 3 [33]
         Vtarget         : 5.1 V
avrdude: Sent: . [03] . [98]
avrdude: Recv: . [03] . [00] . [06]
         SCK period      : 8.00 us

avrdude: Sent: . [10] . [c8] d [64] . [19]   [20] . [00] S [53] . [03] . [ac] S [53] . [00] . [00]
avrdude: Recv: . [10] . [c0]
avrdude: stk500v2_command(): command failed
avrdude: Sent: . [03] . [a1]
avrdude: Recv: . [03] . [00] . [00]
avrdude: stk500v2_program_enable(): bad AVRISPmkII connection status: Unknown status 0x00
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: Sent: . [11] . [01] . [01]
avrdude: Recv: . [11] . [00]

avrdude done.  Thank you.

I know the FTDI module and the AVR ISP MKii both work because I plugged them onto a 1284 board, bootloaded and blinked then went right back to the 2561 and had it fail again.

pins_arduino.h is attached, and the boards.txt section is this
Code: [Select]
mega2561.name=Arduino Mega 2561
mega2561.upload.protocol=wiring
mega2561.upload.maximum_size=258048
mega2561.upload.speed=115200
mega2561.bootloader.low_fuses=0xFF
mega2561.bootloader.high_fuses=0xD8
mega2561.bootloader.extended_fuses=0xFD
mega2561.bootloader.path=stk500v2
mega2561.bootloader.file=stk500boot_v2_mega2560.hex
mega2561.bootloader.unlock_bits=0x3F
mega2561.bootloader.lock_bits=0x0F
mega2561.build.mcu=atmega2561
mega2561.build.f_cpu=16000000L
mega2561.build.core=arduino
mega2561.build.variant=mega2561

IDE 1.0.6.

Any ideas what is going wrong? I  buzzed all the connections from pins to headers and checked pin-to-pin shorts.
I can't find any electrically wrong.






Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

john1993

#1
Feb 20, 2016, 10:13 pm Last Edit: Feb 20, 2016, 11:00 pm by john1993
"bad AVRISPmkII connection status"

depending on version mkII is known to misbehave with some parts and so is ide.  maybe try another programmer like arduino-as-isp or usbasp and command line instead if gui.  1k across xtl is odd but that shouldnt matter with a new chip.  also iirc tqfp100 has different programming pins than tqfp64, maybe you have wrong package?

edit: yup.
Code: [Select]

;       TQFP100  TQFP64
;  MOSI   PB2   PE0
;  MISO   PB3   PE1
;  SCK    PB1   PB1

CrossRoads

The 1K (R4 on the bottom) is a place holder for a 1M and is not actually on the board.

In my 5+ years in the Arduino forums I have never heard of a MKii misbehaving. In fact I would say it is the gold standard.

The other programmers have been known to have problems with the larger memory chips.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

john1993

#3
Feb 20, 2016, 10:40 pm Last Edit: Feb 20, 2016, 10:53 pm by john1993
maybe you missed the update. wrong package is the problem.

reminds me of the time i spent 2 weeks with head up butt because atmel product engineers decided m128 miso/mosi were not really for programming but on completely different pins.  like m2561 buried deep in datasheet. those guys are such great practical jokers.

ps. regarding mkII maybe gold standard in the same way as model t was for horseless carriages.  apparently you were lucky to come in late when many of the bugs were worked out.  as a early adopter i had to upgrade at least half dozen time over the years until wised up and moved to more modern dongles.

larryd

As with 328, I assume you have to set fuses so the controller external crystal is engaged.
Can you confirm the 16 MHz oscillator is running?
I have only worked with the 328 an 1284 though.
.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

CrossRoads

#5
Feb 20, 2016, 10:51 pm Last Edit: Feb 20, 2016, 10:51 pm by CrossRoads
So the pinout from the datasheet which shows SCK-MOSI-MISO and Reset on pins 11-12-13 and 20 is not correct?
Table 13-6 is also wrong?
PB3 MISO/PCINT3 (SPI Bus Master Input/Slave Output or Pin Change Interrupt 3)
PB2 MOSI/PCINT2 (SPI Bus Master Output/Slave Input or Pin Change Interrupt 2)
PB1 SCK/PCINT1 (SPI Bus Serial Clock or Pin Change Interrupt 1)


Where did you find MISO/MOSI on PE0/PE1?

I used same fuse settings as 2560. Have not looked at crystal signal yet, same set as the mini 2560 boards tho.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

larryd

You may have to use an off board CMOS chip to access the clock as your scope might load the oscillator.
.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

john1993

So the pinout from the datasheet which shows SCK-MOSI-MISO and Reset on pins 11-12-13 and 20 is not correct?
Table 13-6 is also wrong?
from what i can tell, yes.  the table in my first post was out of one of my asm programs but this from table 30-15. Pin Mapping Serial Programming:

Code: [Select]

Symbol Pins (TQFP-100) Pins (TQFP-64) I/O Description
PDI PB2 PE0 I Serial Data in
PDO PB3 PE1 O Serial Data out
SCK PB1 PB1 I Serial Clock

CrossRoads

So for Programming Only, when Reset is held Low, MISO is PE0 (which is RXD) and MOSI is PE1 (which is TXD) ?



For normal SPI use, are the PB2 & 3 still used?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

john1993

#9
Feb 20, 2016, 11:14 pm Last Edit: Feb 20, 2016, 11:16 pm by john1993
you assumed miso=pdo and mosi=pdi which is not actually the case.  spi != isp on some avrs. same as with me and m128 when it first came out 15yrs ago.  fortunately by the time m2561 came along i was a little smarter.

like i said, great practical jokers.

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

CrossRoads

Table 30-15. Pin Mapping Serial Programming
Symbol Pins (TQFP-100) Pins (TQFP-64) I/O Description
PDI PB2 PE0 I Serial Data in >> MISO For Programming?
PDO PB3 PE1 O Serial Data out  >> MOSI For Programming?
SCK PB1 PB1 I Serial Clock
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

john1993

you assume miso=pdo and mosi=pdi which is not actually the case.  spi != isp on some avrs.

larryd

Looks like Sparkfun's board in links is using PE0 and PE1
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

john1993

correct. to put it another way MOST avr have isp on same pins as spi.  the truth is, contrary to popular usage miso/mosi are not programming pins. technically pdo (program data out) and pdi (program data in) are the correct terms.  but people being people, too late to change now.

Go Up