Read a Atmega328P chip

I have a atmega 328p-pu chip sitthing on my breadbord. I want to see what is on the chip, so I want to read the chip. Is there any way to read it with a UNO in any way?

You could dump a hex file using avrdude, but "seeing" the source code from that would require a decompiler.

somedude:
You could dump a hex file using avrdude, but "seeing" the source code from that would require a decompiler.

Can you suggest the command line ?
Is this correct?

avrdude -c arduino -p m328p -P COM16 :r: read1.hex

I tried the above command line and it gave the following output

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f

avrdude: safemode: Fuses OK

avrdude done.  Thank you.

however, Where is the "read1.hex" located ??

Do you mean the Disassembler ?
Please suggest one.
Will Atmel Studio 6.2 work?
Will AVRStudio 5 work?
Thank you,
-Malhar

But, when I tried this...

avrdude -v -p m328p -c arduino -v -P COM16 -U flash :r:"C:\D
ocuments and Settings\Administrator>read1.hex":i

This is the output:

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "F:\bin\avrdude.conf"

         Using Port                    : COM16
         Using Programmer              : arduino
         AVR Part                      : ATMEGA328P
         Chip Erase delay              : 9000 us
         PAGEL                         : PD7
         BS2                           : PC2
         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     5     4    0 no       1024    4      0  3600  3600 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  4500 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 : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "flash"
avrdude: error opening flash: No such file or directory
avrdude: input file flash auto detected as invalid format
avrdude: can't open input file flash: No such file or directory
avrdude: write to file 'flash' failed

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK

avrdude done.  Thank you.


C:\Documents and Settings\Administrator>

The clock speed is wrong = 28.000KHz
Which should be = 16MHz
lfuse ,hfuse,efuse are wrong
should be = xff,0xde,0x05 respectively
why does it try to write to flash when i specified " :r " ?
Thank you,
-Malhar

That's not the frequency of your AVR, that's the clock of the programmer.

The syntax for the -U option is -U :r|w|v:[:format]:
Look at this for details.

You have an extra space and the '>' symbol in the file path, that is why it thinks you want to write to 'flash'.
Try:
avrdude -v -p m328p -c arduino -P COM16 -U flash:r:"C:\Documents and Settings\Administrator\read1.hex":i

I am not aware of a disassembler, try 'binging' :wink:
Not sure about the other tools or their capabilities.
You might also want to try a newer avrdude.

Success. I can read the atmega328 chip.
What if I want to do the same with attiny 85?
Should I program the arduino with arduino as Isp ans change the part number to t85?
I want to do this.
or this,which you wanted to do also(REF)
Did you try this? Does his work? Will I brick my attiny?(I van build a HVSP with arduino if possible)
when I try this,

avrdude -c arduino -p t85 -PCOM16 -U flash:r:"c:/ffr1.hex":i

This is the error,Which means that avrdude is reading the m328 on my arduino which is configured as arduinoISP

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "F:\bin\avrdude.conf"

         Using Port                    : COM16
         Using Programmer              : arduino
         AVR Part                      : ATtiny85
         Chip Erase delay              : 4500 us
         PAGEL                         : P00
         BS2                           : P00
         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     6     4    0 no        512    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      8192   64    128  4500  4500 0xff 0xff
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  9000  9000 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
           calibration    0     0     0    0 no          2    0      0     0     0 0x00 0x00

         Programmer Type : Arduino
         Description     : Arduino
         Hardware Version: 3
         Firmware Version: 4.4
         Vtarget         : 0.3 V
         Varef           : 0.3 V
         Oscillator      : 28.800 kHz
         SCK period      : 3.3 us

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f
avrdude: Expected signature for ATtiny85 is 1E 93 0B
         Double check chip, or use -F to override this check.

avrdude done.  Thank you.

and,When I try this,

C:\Documents and Settings\Administrator>avrdude -v -c avrisp -p t85 -PCOM16 -U flash:r:"c:/ffr1.hex"
:i

the error is,

avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2009 Joerg Wunsch

         System wide configuration file is "F:\bin\avrdude.conf"

         Using Port                    : COM16
         Using Programmer              : avrisp
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.

same happens with avrispII,stk500,stk500v2
so how do I read the t85?

I think the tint needs a conf file hack, but I don't have the info right now.

Try googling this: avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

Also, I use avrdude from the Arduino IDE 1.6, you seem to use a standalone older version.
The avrdude configuration files may be different.

avrdude -cstk500v1 -b19200 -P/dev/ttyUSB0 -pt85 -Uflash:r:-:i

This works, you will need to substitute your port (-P) and output file (-) this writes to stdout.
If you still have trouble suppress the reset on your Arduino by placing a ~150 ohm resistor between 5v and reset or a 1uf cap between reset and ground.

tf68:
avrdude -cstk500v1 -b19200 -P/dev/ttyUSB0 -pt85 -Uflash:r:-:i

This works, you will need to substitute your port (-P) and output file (-) this writes to stdout.
If you still have trouble suppress the reset on your Arduino by placing a ~150 ohm resistor between 5v and reset or a 1uf cap between reset and ground.

When even if I suppress the arduinmo reset or not and choose -cstk5000 or -cstk500v2,
it says that,

avrdude: stk500_getsync(): not in sync: resp=0x00

I am using WinAVR,I'll try using avrdude in arduino 1.6.5
Thank you,
-Malhar

MalharD:
and,When I try this,

C:\Documents and Settings\Administrator>avrdude -v -c avrisp -p t85 -PCOM16 -U flash:r:"c:/ffr1.hex"

:i




the error is,



avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
        Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
        Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "F:\bin\avrdude.conf"

Using Port                    : COM16
        Using Programmer              : avrisp
avrdude: stk500_getsync(): not in sync: resp=0x00

avrdude done.  Thank you.




same happens with avrispII,stk500,stk500v2

But, ArduinoISP sketch states tht it will turn arduino into avrisp...

// ArduinoISP version 04m3
// Copyright (c) 2008-2011 Randall Bohn
// If you require a license, see 
//     http://www.opensource.org/licenses/bsd-license.php
//
// This sketch turns the Arduino into a AVRISP
// using the following arduino pins:

So, why do I get the error?