Go Down

Topic: Arduino Mega 2560 not detected (Read 2976 times) previous topic - next topic

Avamander

I recently bought a arduino mega clone but I haven't been able to upload anything to it. I have linux mint on my computer and it does not detect it at all. When I press reset the (D13) led blinks twice, loopback test results scrambled data. I had to connect a pulldown for the led to blink properly. I was unable to program the mega via ICSP. Any ideas what could I do now?

Avamander

#1
May 20, 2015, 08:16 pm Last Edit: May 20, 2015, 08:19 pm by Avamander
I tried reflashing the 16u2 firmware but using my nano as an ISP programmer only results in "programmer not responding", changing the baudrate resulted in "not in sync: resp=0x15".

Avamander

#2
May 20, 2015, 08:59 pm Last Edit: May 24, 2015, 03:00 pm by Avamander
Sometimes it does this.

Code: [Select]
avrdude -b 19200 -v -e  -p at90usb82 -F -P /dev/ttyUSB2 -c avrisp -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m

avrdude: Version 5.11.1, compiled on Apr 28 2013 at 18:46:52
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch

        System wide configuration file is "/etc/avrdude.conf"
        User configuration file is "/home/t/.avrduderc"
        User configuration file does not exist or is not a regular file, skipping

        Using Port                    : /dev/ttyUSB2
        Using Programmer              : avrisp
        Overriding Baud Rate          : 19200
        AVR Part                      : AT90USB82
        Chip Erase delay              : 9000 us
        PAGEL                         : PD7
        BS2                           : PC6
        RESET disposition             : possible i/o
        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    20     4    0 no        512    4    128  9000  9000 0x00 0x00
          flash         65     6   128    0 yes      8192  128     64  4500  4500 0x00 0x00
          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          1    0      0     0     0 0x00 0x00
          signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

        Programmer Type : STK500
        Description     : Atmel AVR ISP
        Hardware Version: 2
        Firmware Version: 1.18
        Topcard         : Unknown
        Vtarget         : 0.0 V
        Varef           : 0.0 V
        Oscillator      : Off
        SCK period      : 0.1 us

avrdude: stk500_recv(): programmer is not responding

Avamander

I tried this morning again to program it trough ICSP, it still does not work, any ideas how I could get them in sync? Is this reset related issue?

Avamander

I bought an ISP programer, I was able to write the bootloader to the mega. Now the d13 led flashes periodically, but I am unable to write any other software on it.

CrossRoads

If you have an ISP programmer, you can select File:Upload Using Programmer to load sketches.
It overwrites the bootloader, but the sketch starts immediately after a reset.
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.

Avamander

#6
May 21, 2015, 07:22 pm Last Edit: May 21, 2015, 07:25 pm by Avamander
I tried some more things.
If trying to program the 16u2 it always results in "Not responding" or "wrong signature" (it changes too). If I try to program the mega2560 it usually results in "timeout", "not responding" or "wrong signature".
D13 LED blinks rapidly all the time. When I press reset it stops blinking, then blinks slowly for a few moments and then starts blinking rapidly. To make D13 LED turn off I had to add a pulldown resistor because otherwise my hand would make it dim (turn off or flicker). USBasp throws an error that I should update it's firmware but there is no jumpers or anything to do this.

EDIT: I also tried to flash using DFU but it does not even appear as an USB device. I tried another cable, another USB port. I have tried everything googling yielded. Still no proper results.

edsa

Try conecting it in the back of the computer. Front usbs didn't work for me...

Avamander

I tried it on all the free USB ports. It yielded no results. I will try powering it with external supply and see if that helps.

Avamander

#9
May 22, 2015, 03:33 pm Last Edit: May 24, 2015, 02:59 pm by Avamander
Hmm, it seems that if I unplug everything, plug in external power, then power up the USBISP I managed to rewrite bootloader, it worked without any errors, now I guess the mega2560 has a bootloader but the 16u2 is resetting it (that's why the blinking happens). I need to find how to reprogram the 16u2.

EDIT: Any ideas anyone?
Code: [Select]
avrdude: Version 6.0.1, compiled on Oct 25 2013 at 18:02:21
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/t/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : -U
         Using Programmer              : usbASP
avrdude: usbasp_open("-U")
avrdude: seen device from vendor ->www.fischl.de<-
avrdude: seen product ->USBasp<-
         AVR Part                      : ATmega16U2
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC6
         RESET disposition             : possible i/o
         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    20     4    0 no        512    4    128  9000  9000 0x00 0x00
                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           flash         65     6   128    0 yes     16384  128    128  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 : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: usbasp_initialize()
avrdude: usbasp_transmit("USBASP_FUNC_GETCAPABILITIES", 0x00, 0x00, 0x00, 0x00)
avrdude: usbasp_spi_set_sck_period(0)
avrdude: auto set sck period (because given equals null)
avrdude: usbasp_transmit("USBASP_FUNC_SETISPSCK", 0x00, 0x00, 0x00, 0x00)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: usbasp_transmit("USBASP_FUNC_CONNECT", 0x00, 0x00, 0x00, 0x00)
avrdude: usbasp_program_enable()
avrdude: usbasp_transmit("USBASP_FUNC_ENABLEPROG", 0x00, 0x00, 0x00, 0x00)
         <= [01]
avrdude: error: programm enable: target doesn't answer. 1
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x78d46e
avrdude: Expected signature for ATmega16U2 is 1E 94 89
avrdude: usbasp_close()
avrdude: usbasp_transmit("USBASP_FUNC_DISCONNECT", 0x00, 0x00, 0x00, 0x00)

avrdude done.  Thank you.

Avamander

Should I just order a new one? Or is there any hope to fix it?

CrossRoads

Have you seen the pages on uploading code to the 16U2? It's pretty straightforward.
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.

Avamander

Have you seen the pages on uploading code to the 16U2? It's pretty straightforward.

I did try. You can see the terminal output from post #10.

Avamander

#13
May 25, 2015, 10:37 am Last Edit: May 30, 2015, 10:33 am by Avamander
I can rewrite the bootloader of 2560 but not the 16u2 one. Blink sketch does not work when written on the board. I gave up now.

UPDATE: If someone has any idea how to make it atleast somewhat useful please let me know.

Go Up