Factory Reset Mega2560 and Mega2560V

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

Hello everybody,
is there any way to Factory Reset Mega2560 and Mega2560V, which can set all fuses to default, erase bootloaders etc.?

Thank you

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

While there is no "restore factory defaults" feature that I am aware of, if communication to the chip can be made with ISP or JTAG or similar that has the ability to change fuses then isn't it a simple matter to do a chip-erase along with setting the fuses to the desired pattern?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

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

Hello Theusch,
Thank you for the reply - I am actually trying to burn bootloaders into Atmega2560V-8AU running on 8Mhz, I have got this from my friend, of which I think he has uploaded some different bootloaders and set fuses into it.I am trying to burn MegaCore bootloaders to this chip now, The connections are okay (I have checked 1000) times.
It gives me

avrdude: Device signature = 0x000000

 

Is there any way to check my connections to the Atmega2560V with Arduino UNO ( As I am using Arduino as ISP programmer) is okay or not.?
 

if not with the Arduino environment, Then how about Atmel Studio environment.?

 

Thank You

Last Edited: Wed. Aug 9, 2017 - 08:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I think this chip is set to incorrect fuse bit settings - which means I have bricked my Atmega2560V.?

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

The very first thing to do is to slow down the ISP clock rate. Keep trying and if that does not work, slow it one more notch and try again.

 

The key, here, is that the ISP signal must have a clock rate that is slower than 1/4 of the internal clock rate. If the thing has been set so that the MCU clock is 32KHz (there are a few crazies who do that), then you would need to have the ISP clock slower than 8.192KHz!

 

If you get it connected at this slow baud rate, then change the fuse(s) and start over at a reasonable clock rate. The new clock rate does not become effective until the MCU goes through a reset cycle.

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

The very first thing to do is to slow down the ISP clock rate.

How do i do that.? :/ 

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

BTW you might want to read this:

 

http://www.avrfreaks.net/forum/t...

 

The good news is that 2560 does not have any "dangerous" fuses like RSTDISBL on smaller AVRs

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

Thank you Calwson,

I have read that thread, I want to try this one with my chips..I have understood about providing 1Mhz to XTAL1 pin on Atmega2560, I can use 555Timer chip OR Arduino UNO (PORTB) pin with the code given.

 

BUT - How can I  set my programmer speed to 1/4th of it.? if I supply 1Mhz to XTAL1 on Atmega2560, then I have to make my ISP programmer run on 250Khz.? if 'YES' how can I do that.? I am using Arduino as ISP, I have uploaded the example sketch provided in the IDE...

I also have USBasp programmer http://www.amazon.in/Embeddinator-ENG-PROGV1-1-AVR-USB-ASP-Programmer/dp/B01MT0IFT6?tag=googinhydr18418-21 & Arduino UNO and Arduino Mega.?

Thank you
 
 

 

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

Most programmers and programming software default to 250k ISP clock anyway.

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

When using an Arduino as a programmer, in the sketch you load, look for this:

// Configure SPI clock (in Hz).
// E.g. for an attiny @128 kHz: the datasheet states that both the high
// and low spi clock pulse must be > 2 cpu cycles, so take 3 cycles i.e.
// divide target f_cpu by 6:
//     #define SPI_CLOCK            (128000/6)
//
// A clock slow enough for an attiny85 @ 1MHz, is a reasonable default:

#define SPI_CLOCK 		(1000000/6)

here is where you set the programming speed, it defaults to less then 250k, so you should be good to go!

 

Jim

 

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

Hello Clawson,
I have tried that method by making my Arduino Mega at 1Mhz using that code, I have soldered a jumper wire from Arduino pin number 10 ( Which I suppose it should be on PORTB), I removed 8Mhz crystal which was soldered to Atmega2560V <- Target microprocessor, tried to flash bootloaders I get this error

 

Arduino: 1.8.3 (Windows 10), Board: "ATmega2560, Arduino MEGA pinout, 2.7v, Disabled (default), 8 MHz external"

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf -v -patmega2560 -cstk500v1 -PCOM4 -b19200 -e -Ulock:w:0x3f:m -Uefuse:w:0xfd:m -Uhfuse:w:0xd6:m -Ulfuse:w:0xf7:m 

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf"

         Using Port                    : COM4
         Using Programmer              : stk500v1
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega2560
         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
           flash         65    10   256    0 yes    262144  256   1024  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 STK500 Version 1.x firmware
         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: AVR device initialized and ready to accept instructions

Error while burning bootloader.
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e9803
avrdude: Expected signature for ATmega2560 is 1E 98 01
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

 did you see this...

 

avrdude: Device signature = 0x1e9803
avrdude: Expected signature for ATmega2560 is 1E 98 01

what should be problem now.? 

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

beingmachine wrote:
what should be problem now.?

It apparently isn't the processor you think it is.

 

beingmachine wrote:
Device signature = 0x1e9803

What AVR model has that signature?

 

Interesting...

Do you get the same results repeatedly?

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Last Edited: Thu. Aug 10, 2017 - 09:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Do you get the same results repeatedly?

Yes, I am getting the same results repeatedly, I have connected 1Mhz pin to pin 34 of Atmega2560V 

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

Is that because I am powering Atmega2560V(Target Microcontroller)  with 3.3V and Arduino UNO(as ISP programmer)  and Arduino Mega (generating 1Mhz )at 5V, All three are sharing common ground..

Last Edited: Thu. Aug 10, 2017 - 09:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It apparently isn't the processor you think it is.

 

 

 

 

 

To make it sure - It's Atmega2560V-8AU only

Last Edited: Thu. Aug 10, 2017 - 10:17 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have just tried Nick Gammon, Chip detector Sketch and it shows me this output : 

 

Atmega chip detector.
Written by Nick Gammon.
Version 1.20
Compiled on Aug 11 2017 at 04:43:44 with Arduino IDE 10803.
Attempting to enter ICSP programming mode ...
Entered programming mode OK.
Signature = 0x1E 0x98 0x03 
Unrecogized signature.
LFuse = 0xC0 
HFuse = 0xD9 
EFuse = 0xFF 
Lock byte = 0xFF 
Clock calibration = 0xFF 

First 256 bytes of program memory:

00: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
10: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
20: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
30: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
40: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
50: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
60: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
70: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
80: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
90: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
A0: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
B0: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
C0: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
D0: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
E0: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 
F0: 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 0xFF 0xFF 0x00 0x00 

Programming mode off.

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

I am out of ideas now :( PLease help

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

The conf file for avrdude at:

 

http://svn.savannah.gnu.org/view...

 

usually "knows" most device signatures but when I search that for "0x1e 0x98" then I hit the 0x01 and 0x02 (and also 0x46, 0x47 ... etc) but there is no sign of 0x1E 0x98 0x03. So this truly is a mysterious AVR!!

 

This might be one occasion on which it's an idea to over-ride the signature check ?

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

This might be one occasion on which it's an idea to over-ride the signature check ?

How to do that.?

 

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

Yeah, override with option -F and connect with avrdude in terminal mode (option -t) so that you can check the memory. Try writing a few bytes manually to the eeprom and/or flash and see if they are written correctly.

 

 

edit: command -> avrdude -CC:\Users\mudas\OneDrive\Documents\Arduino\hardware\MegaCore-master\avr/avrdude.conf -patmega2560 -cstk500v1 -PCOM4 -b19200 -F -t

Last Edited: Fri. Aug 11, 2017 - 05:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
I have override using -F and burnt bootloaders to it using settings external 8Mhz Crystal, then i soldered 8Mhz crystal - upload blink sketch and it works.. and the Device signature is back to 0x1e9801

Thanks a lot, thanks a TON! :)