Go Down

Topic: Atmega128A problem -- Using MegaCore (Read 2905 times) previous topic - next topic

acumensw

Hi,
{{If I am in wrong place, please point out, will move the thread accordingly. }}
I tried experimenting with a custom Arduino and chose Atmega128A on a tqfp board.
I followed the circuits as the minimum defined on the MegaCore.
https://github.com/MCUdude/MegaCore

But trying to upload, or burn the bootloader, I am facing issues.

I have a USB to ttl serial adapter that is also used for Pro Mini programming.

When burning the bootloader, I get :
<code>

/Users/macintosh/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/bin/avrdude -C/Users/macintosh/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/avrdude.conf -v -patmega128 -cstk500 -P/dev/cu.SLAB_USBtoUART -e -Ulock:w:0x3f:m -Uefuse:w:0xff:m -Uhfuse:w:0xc6:m -Ulfuse:w:0xbf:m

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

         System wide configuration file is "/Users/macintosh/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/avrdude.conf"
         User configuration file is "/Users/macintosh/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.SLAB_USBtoUART
         Using Programmer              : stk500
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
         AVR Part                      : ATmega128
         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         4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500V2
         Description     : Atmel STK500
         Programmer Model: Unknown
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
/Users/macintosh/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/bin/avrdude -C/Users/macintosh/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/avrdude.conf -v -patmega128 -cstk500 -P/dev/cu.SLAB_USBtoUART -Uflash:w:/Users/macintosh/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/bootloaders/optiboot_flash/atmega128/optiboot_flash_atmega128_115200_16MHz.hex:i -Ulock:w:0x0f:m

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

         System wide configuration file is "/Users/macintosh/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/avrdude.conf"
         User configuration file is "/Users/macintosh/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.SLAB_USBtoUART
         Using Programmer              : stk500
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
         AVR Part                      : ATmega128
         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         4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500V2
         Description     : Atmel STK500
         Programmer Model: Unknown
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout

</code>


When trying to upload the sketch, I get similar output.

What could be going wrong here?

[I am one of the silent readers, and try my best to dig the forum before starting a duplicate thread. Had been lucky so far. ]

pert

If I am in wrong place, please point out, will move the thread accordingly.
These topics usually get discussed in the Microcontrollers forum section but I think you chose an appropriate section.

I have a USB to ttl serial adapter that is also used for Pro Mini programming.
Unless you bought a chip with a bootloader already installed, you need to do Tools > Burn Bootloader before you can do an upload via serial using that adapter. Which in-system programmer(ISP) are you using?

You were correct to try to put the avrdude output in code tags but the tags you used don't work on this forum. You can use the </> button on the toolbar to get the correct tags.

acumensw

Thanks pert. Will checkout the available tags in future. Should have noted the the </> in the beginning. :-)


This is a minimal board 

 

I tried using another Arduino Uno as the the ISP.


pert

Did you select Tools > Programmer > Arduino as ISP when you tried to burn the bootloader? When I do that my avrdude command is different(-cstk500v1 instead of your -cstk500 which ends up specifying STK500V2).

acumensw

You are right. I tried so many times, that I confused myself.

Here is what I get when I use Arduino as ISP.

Code: [Select]

Arduino: 1.6.9 (Mac OS X), Board: "ATmega128, 16MHz external (BOD 2.7v)"

/Users/macowner/Library/Arduino15/packages/arduino/tools/avrdude/6.3.0-arduino6/bin/avrdude -C/Users/macowner/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/avrdude.conf -v -patmega128 -cstk500v1 -P/dev/cu.usbmodem1411 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0xff:m -Uhfuse:w:0xc6:m -Ulfuse:w:0xbf:m

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

         System wide configuration file is "/Users/macowner/Library/Arduino15/packages/MegaCore/hardware/avr/1.0.3/avrdude.conf"
         User configuration file is "/Users/macowner/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : /dev/cu.usbmodem1411
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15
         AVR Part                      : ATmega128
         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         4    12    64    0 no       4096    8      0  9000  9000 0xff 0xff
           flash         33     6   128    0 yes    131072  256    512  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

         Programmer Type : STK500
         Description     : Atmel STK500 Version 1.x firmware

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x02

avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x10
         Hardware Version: -1559310084
         Firmware Version: -1073745416.440209
         Topcard         : STK502
         Vtarget         : 1.8 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: stk500_initialize(): (b) protocol error, expect=0x10, resp=0x01
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x10

avrdude done.  Thank you.

Problem uploading to board.  See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


liuzengqiang

You should try Nick Gammon's hex uploader:

http://www.gammon.com.au/uploader
This program needs to be loaded to your Arduino UNO, with an SD card. It will read fuses and signatures from the target board. If that doesn't work, you like have some hardware issues such as design or soldering.
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter

pert

There's further discussion on the GitHub issue that acumensw opened:
https://github.com/MCUdude/MegaCore/issues/21

Go Up