read Arduino Pro Mini

hello friends i have usb to TTL CP2102 6 pins with DTR for connection to Arduino mini pro and i want read my Arduino Pro Mini code if any one can help me here
thanks

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum as a whole.

Bob.

This can be difficult.

It would be assembler code at best.

Just look at the source code itself.

some one told me mini pro is not protected then why we cant read its code

Because the sketch that was written originally was COMPILED into another form and that form bears no direct resemblance to the sketch itself even though it performs the functions laid out in the sketch.

Unless you can fully decompile (not a simple task for everyone) then what you will get back from the board will only be really useful to upload to an identical board to CLONE the original one.

then how i can clone mini pro it i got identical boards any one can guide me

Using an ICSP programmer and avrdude, you can read an unprotected 328P and store the data in a file.

Next you can write it to another 328P using avrdude and that same programmer.

msalman:
then how i can clone mini pro it i got identical boards any one can guide me

Sure. Do this:

Connect your CP2102 to the Pro Mini you want to read from.

Start the Arduino IDE.

Note the ports that are in the Arduino IDE's Tools > Port menu. If the menu is grayed out, there are no ports.

Close the Arduino IDE's Tools menu.

Connect the CP2102 to your computer.

Note the ports that are in the Arduino IDE's Tools > Port menu. The new port is the port of your CP2102. Select that port. If the menu is grayed out, then you need to install the driver for the CP2102.

VERY IMPORTANT: disconnect the CP2102 from your computer.

Tools > Board > Arduino Pro or Pro Mini

File > Preferences

Uncheck the box next to "Show verbose output during: Compilation".

Check the box next to "Show verbose output during: Upload".

Click the "OK" button.

Sketch > Upload

Wait for the upload to fail. This is what we want to happen. The purpose of the upload is to get the Arduino IDE to generate the command you are going to modify to read and write the file from the Pro Mini. We don't actually want to do an upload to the Pro Mini, because that would overwrite the program you want to read. We just want the Arduino IDE to attempt the upload process.

Copy the upload command from the black console window at the bottom of the Arduino IDE window. In my case, the output looked like this:

Sketch uses 924 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b57600 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_421424/Blink.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf"

         Using Port                    : COM17
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
avrdude: ser_open(): can't open device "\\.\COM17": The system cannot find the file specified.



avrdude done.  Thank you.

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

So my upload command is this:

C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b57600 -D -Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_421424/Blink.ino.hex:i

Open a text editor (you can use the Arduino IDE if you like).

Paste the upload command you copied.

Modify the upload command by changing the part that looks something like this:

-Uflash:w:C:\Users\per\AppData\Local\Temp\arduino_build_421424/Blink.ino.hex:i

To look something like this:

-Uflash:r:readfile.hex:i

By changing the "w" to "r", you are making the command read instead of write. The "readfile.hex" is the filename that the program read from your Pro Mini will be saved to. You can name it whatever you like. So now my read command looks like this:

C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b57600 -D -Uflash:r:readfile.hex:i

Copy the read command.

Start the command line.

Navigate to a folder where you can save the file you read from the Pro Mini.

Connect the CP2102 to your computer.

Paste the copied read command.

Run the command. The command should run successfully and you should now have a file named readfile.hex in the folder you ran the command from.

Unplug the CP2102 from your computer.

Disconnect your CP2102 from the Pro Mini you read from.

Connect your CP2102 to the Pro Mini you want to write to.

Connect the CP2102 to your computer.

Now you are going to modify the read command to write. You do this by changing the part that looks something like:

-Uflash:r:readfile.hex:i

to:

-Uflash:w:readfile.hex:i

So my write command looks like this:

C:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/bin/avrdude -CC:\Users\per\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino17/etc/avrdude.conf -v -patmega328p -carduino -PCOM17 -b57600 -D -Uflash:w:readfile.hex:i

Copy the write command.

Paste the write command to the command line.

Press and release the reset button on your Pro Mini.

Immediately run the write command. The write command should finish successfully. The Pro Mini you wrote to is now loaded with the exact same program as the Pro Mini you read from. You can write that file to as many more Pro Minis as you like.

sterretje:
Using an ICSP programmer and avrdude, you can read an unprotected 328P and store the data in a file.

Next you can write it to another 328P using avrdude and that same programmer.

Happily, a programmer is not required for this. As long as the board has a bootloader on it (which is very likely the case here), you can read and write the hex file via the USB to serial connection. Of course, you can do it with a programmer too, and I'm happy to provide those instructions as required, but I think this way is the easiest.

hello brother sorry for late reply

i have set both blinks delay to 100 in my new mini pro read and saved hex file
but after writing same 100 delay blink hex file to same mini pro on first try it write 100% but with some kind error in verification and after that i cant change blink to 1000 or 10 in arduino software its giving me verification errors but if i upload 100 blink with cmd or arduino software it uploads without error!

this was my first hex file writing in cmd result

C:\Users\Administrator\Desktop>D:\software\arduino-1.8.10\hardware\tools\avr/bin
/avrdude -CD:\software\arduino-1.8.10\hardware\tools\avr/etc/avrdude.conf -v -pa
tmega328p -carduino -PCOM5 -b57600 -D -Uflash:w:C:\ok\Blink.ino.hex:i

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "D:\software\arduino-1.8.10\hardware\
tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         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  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  36
00 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  45
00 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  45
00 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: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "C:\ok\Blink.ino.hex"
avrdude: writing flash (32670 bytes):

Writing | ################################################## | 100% 10.53s

avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against C:\ok\Blink.ino.hex:
avrdude: load data flash data from input file C:\ok\Blink.ino.hex:
avrdude: input file C:\ok\Blink.ino.hex contains 32670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 8.19s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x7f00
         0xff != 0x09
avrdude: verification error; content mismatch

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.


C:\Users\Administrator\Desktop>pause
Press any key to continue . . .

this is arduino gui error with blink test

Arduino: 1.8.10 (Windows 7), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

Sketch uses 924 bytes (3%) of program storage space. Maximum is 30720 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 2039 bytes for local variables. Maximum is 2048 bytes.
D:\software\arduino-1.8.10\hardware\tools\avr/bin/avrdude -CD:\software\arduino-1.8.10\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -carduino -PCOM5 -b57600 -D -Uflash:w:C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_165839/Blink.ino.hex:i 

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "D:\software\arduino-1.8.10\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         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    20     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: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_165839/Blink.ino.hex"
avrdude: writing flash (924 bytes):

Writing | ################################################## | 100% 0.21s

avrdude: 924 bytes of flash written
avrdude: verifying flash memory against C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_165839/Blink.ino.hex:
avrdude: load data flash data from input file C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_165839/Blink.ino.hex:
avrdude: input file C:\Users\ADMINI~1\AppData\Local\Temp\arduino_build_165839/Blink.ino.hex contains 924 bytes
avrdude: reading on-chip flash data:

Reading | ###############################An error occurred while uploading the sketch
################### | 100% 0.21s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0042
         0x12 != 0x13
avrdude: verification error; content mismatch

avrdude done.  Thank you.

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




this is 2nd mini pro hex with 1000ms blink i tested on first one with cmd which didnt worked ??
so basically first mini pro is locked with 100mb after writing hex with cmd and one circuit hex wont work on other one

C:\Users\Administrator\Desktop>D:\software\arduino-1.8.10\hardware\tools\avr/bin
/avrdude -CD:\software\arduino-1.8.10\hardware\tools\avr/etc/avrdude.conf -v -pa
tmega328p -carduino -PCOM5 -b57600 -D -Uflash:w:C:\ok\sketch_mar08a.ino.hex:i

avrdude: Version 6.3-20190619
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "D:\software\arduino-1.8.10\hardware\
tools\avr/etc/avrdude.conf"

         Using Port                    : COM5
         Using Programmer              : arduino
         Overriding Baud Rate          : 57600
         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  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           eeprom        65    20     4    0 no       1024    4      0  3600  36
00 0xff 0xff
           flash         65     6   128    0 yes     32768  128    256  4500  45
00 0xff 0xff
           lfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  4500  45
00 0x00 0x00
           lock           0     0     0    0 no          1    0      0  4500  45
00 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: 2
         Firmware Version: 1.16
         Vtarget         : 0.0 V
         Varef           : 0.0 V
         Oscillator      : Off
         SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: reading input file "C:\ok\sketch_mar08a.ino.hex"
avrdude: writing flash (32670 bytes):

Writing | ################################################## | 100% 8.28s

avrdude: 32670 bytes of flash written
avrdude: verifying flash memory against C:\ok\sketch_mar08a.ino.hex:
avrdude: load data flash data from input file C:\ok\sketch_mar08a.ino.hex:
avrdude: input file C:\ok\sketch_mar08a.ino.hex contains 32670 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 8.21s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0042
         0x12 != 0x13
avrdude: verification error; content mismatch

avrdude: safemode: lfuse reads as 0
avrdude: safemode: hfuse reads as 0
avrdude: safemode: efuse reads as 0
avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.


C:\Users\Administrator\Desktop>pause
Press any key to continue . . .

1000ms blink mini pro.zip (6.17 KB)