
Turn Arduino into a full-fledged AVRISP programmer
- Tutorial

I welcome all users of the Habr , in particular those who suffer from the Arduino theme , as I do.
I have been asked for a long time - is it possible to flash hex files using Arduino? Change fuses? Read firmware? And all that ... The answer is yes, and today I will tell you how I do it.
(This video duplicates the information below)
Arduino is a great start for me for a beginner, but you need to grow further, the world of microcontrollers is beautiful and offers great opportunities, but, alas, Arduino is a pretty narrow-minded area.
A little background:
One fine day, I came across a great project on ATtiny13, but alas, the author uploaded only a hex-file and a circuit to the network, and of course, I could not try it in hardware. This question tormented me more and more, and then I accidentally stumbled upon one video on the network, where the author claimed that he had flashed another microcontroller using Arduino, having only a hex-file, and of course the circuit. It was he who told me - use SinaProg, but with Arduino's files ...
Googling on SinaProg, I downloadedSinaProg 2.1.1.RUS , but it refused to work with Arduino, so I threw a couple of files from the Arduino IDE into the SinaProg 2.1.1 \ data \ folder and it all worked.
Let's take a brief look at the capabilities of the software:

In the Hex-file block, select hex or eep (the first is the firmware, the second is the contents of non-volatile memory).
And in the part where the ">" button, we can see all sorts of messages, such as "OK", or "ERROR", the ">" button itself opens the Avrdude logs .
There are buttons in the Flash block :
Program - write a hex file to a microcontroller (possibly when a Hex-file is selected);
Verify - checking the firmware in the microcontroller and the hex file (in other words, comparing them), if everything is fine - the program says OK;
Read - read the hex file.
With the EEPROM block, everything is similar.
Next is the Device block , here you can select the desired microcontroller, here is the entire list of supported ones (the list was torn from the Device.txt file, which lies in the SinaProg 2.1.1 \ data \ folder):
Here is a couple of them
Joke, out of many:
AT90CAN128
AT90CAN32
AT90CAN64
AT90PWM2
AT90PWM2B
AT90PWM3
AT90PWM3B
AT90USB1286
AT90USB1287
AT90USB162
AT90USB646
AT90USB647
AT90USB82
AT90S1200
AT90S2313
AT90s2323
AT90s2333
AT90s2343
AT90s4414
AT90S4433
AT90s4434
AT90S8515
AT90S8535
ATmega103
ATmega128
ATmega1280
the ATmega1281
ATmega1284P
ATmega128RFA1
the ATmega16
ATmega161
ATmega162
ATmega163
ATmega164P
The ATmega168
ATmega169
ATmega2560
ATmega2561
ATmega32
ATmega324P
ATmega325
ATmega3250
ATmega328P
ATmega329
ATmega3290
ATmega3290P
ATmega329P
ATmega48
ATmega64
ATmega640
ATmega644
ATmega644P
ATmega645
ATmega6450
ATmega649
ATmega6490
ATmega8 Activity Kit Manual
ATmega8515
ATmega8535
ATmega88
ATtiny11
ATtiny12
the ATtiny13
ATtiny15
ATtiny22 2343
ATtiny2313
ATtiny24
ATtiny25
ATtiny26
ATtiny261
ATtiny44
Attiny45
ATtiny461
ATtiny84
ATtiny85
ATtiny861
ATtiny88
ATxmega64A1
ATxmega128A1
ATxmega128A1D
ATxmega192A1
ATxmega256A1
ATxmega64A3
ATxmega128A3
ATxmega192A3
ATxmega256A3
ATxmega256A3B
ATxmega16A4
ATxmega32A4
ATxmega64A4
ATxmega128A4
AT90CAN128
AT90CAN32
AT90CAN64
AT90PWM2
AT90PWM2B
AT90PWM3
AT90PWM3B
AT90USB1286
AT90USB1287
AT90USB162
AT90USB646
AT90USB647
AT90USB82
AT90S1200
AT90S2313
AT90s2323
AT90s2333
AT90s2343
AT90s4414
AT90S4433
AT90s4434
AT90S8515
AT90S8535
ATmega103
ATmega128
ATmega1280
the ATmega1281
ATmega1284P
ATmega128RFA1
the ATmega16
ATmega161
ATmega162
ATmega163
ATmega164P
The ATmega168
ATmega169
ATmega2560
ATmega2561
ATmega32
ATmega324P
ATmega325
ATmega3250
ATmega328P
ATmega329
ATmega3290
ATmega3290P
ATmega329P
ATmega48
ATmega64
ATmega640
ATmega644
ATmega644P
ATmega645
ATmega6450
ATmega649
ATmega6490
ATmega8 Activity Kit Manual
ATmega8515
ATmega8535
ATmega88
ATtiny11
ATtiny12
the ATtiny13
ATtiny15
ATtiny22 2343
ATtiny2313
ATtiny24
ATtiny25
ATtiny26
ATtiny261
ATtiny44
Attiny45
ATtiny461
ATtiny84
ATtiny85
ATtiny861
ATtiny88
ATxmega64A1
ATxmega128A1
ATxmega128A1D
ATxmega192A1
ATxmega256A1
ATxmega64A3
ATxmega128A3
ATxmega192A3
ATxmega256A3
ATxmega256A3B
ATxmega16A4
ATxmega32A4
ATxmega64A4
ATxmega128A4
As you can see, there are all the popular ATmel microcontrollers, in particular ATmega328P, ATmega8, ATtiny13, ATtiny2313 and all sorts of others ...
Next - the Search button , if you click it, the program will try to read the signatures of the microcontroller that is connected to the programmer, in other words, it will look for the microcontroller . Then he can answer “OK” or “ERROR” in the information block if everything is normal or not, respectively.
In the Fuses block there are presets for ATmega8 to work at different frequencies, but, alas, only for ATmega8 and ATmega32, you can add it to the Fuse.txt file (which lies in the SinaProg 2.1.1 \ data \ folder).
There is a Program button - record presets, look at the paragraph above.
And also Advanced - a dashing button, after pressing it you can see such a window:

Device signature - some digits, as I understand it is the identifier of the microcontroller, the program recognizes by it what kind of microcontroller we owe it.
The information part, everything is as above.
Fuses are a little lower ... if it is combed, then do not forget to read them first with the Read button (in order not to deliberately change important fuses, for example “SPIEN” or “RSTDSBL” ), write fuses - Write button, Chip Erase button erases the microcontroller, something approximately reminds - formatting a USB flash drive on a computer (but fuses are not installed by default, so you should not forget about it).
A few words about the fuse bits are like fine tuning the microcontroller, then raise the frequency, then turn it down, then turn on / off the clock from the internal RC chain is something else ... in general, climb there only as a last resort, otherwise you can block microcontroller (to lure so that stops working, seriously), and already without Atmega fusebit doctor in any way.
Here is the first link from google for “fusion calculator”, but I warn you, poke something there, not knowing why it is, and then write it to the microcontroller - it won’t lead to anything good, I know.
Further, there was still some kind of information block, did not delve into it much. Well, the exit button, I think you already guessed it, even if you don’t know English.
So, the last block of the main program window isProgrammer , here the type of programmer is selected, if you use Arduino as a programmer - put everything as I have on the screen, but not COM19, this is mine, you probably will have a different one, in any case it’s definitely not COM1, the first one system, relevant only for programmers that connect to a real COM port, for example, Gromov Programmer . There may not be a COM port on a laptop, but on computers, as a rule, there is still a COM port, especially older ones. You can use another programmer, for example, USBASP , just do not forget to select it in the list, I set the speed for it the same as in the case of AVRISP.
List of supported programmers:
It will not be enough
Gromov
USBtiny
ALF
Arduino
AT ISP
AVR109
AVR910
AVR911
AVRISP
AVRISP 2
AVRISP mkII
AVRISP v2
Bascom
Blaster
BSD
Butterfly
C2N232I
DAPA
DASA
DASA 3
Dragon_DW
Dragon_HVSP
Dragon_ISP
Dragon_JTAG
Dragon_PP
DT006
ERE-ISP-AVR
Frank-STK200
Futurlec
JTAG 1
JTAG 1Slow
JTAG 2Slow
JTAG 2
JTAG 2Fast
JTAG 2ISP
JTAG 2dW
JTAG mkI
JTAG mkII
MIB510
pAVR
Picoweb
Pony-STK200
ponyser
SI Prog
SP12
STK200
STK500
STK500 HVSP
STK500 PP
STK500 v1
STK500 v2
STK600
STK600 HVSP
STK600 PP
USBasp
Xil
USBtiny
ALF
Arduino
AT ISP
AVR109
AVR910
AVR911
AVRISP
AVRISP 2
AVRISP mkII
AVRISP v2
Bascom
Blaster
BSD
Butterfly
C2N232I
DAPA
DASA
DASA 3
Dragon_DW
Dragon_HVSP
Dragon_ISP
Dragon_JTAG
Dragon_PP
DT006
ERE-ISP-AVR
Frank-STK200
Futurlec
JTAG 1
JTAG 1Slow
JTAG 2Slow
JTAG 2
JTAG 2Fast
JTAG 2ISP
JTAG 2dW
JTAG mkI
JTAG mkII
MIB510
pAVR
Picoweb
Pony-STK200
ponyser
SI Prog
SP12
STK200
STK500
STK500 HVSP
STK500 PP
STK500 v1
STK500 v2
STK600
STK600 HVSP
STK600 PP
USBasp
Xil
Personally, I only tested on the programmers AVRISP (Arduino with the stitched sketch ArduinoISP) and USBasp, on two microcontrollers - ATmega8 and ATtiny13.
In order to be able to sew / read / modify fuses / kill the microcontroller using Arduino, you first need to flash the ArduinoISP sketch, connecting everything as I wrote, for example, here:
ATtiny13 firmware and programming using Arduino .
In a nutshell, then we connect the Reset, MOSI, MISO, SCK pins of the microcontroller, which we will flash / read the firmware / change the fuses as indicated in the sketch in the comments, namely:
...
// pin name: not-mega: mega(1280 and 2560)
// slave reset: 10: 53
// MOSI: 11: 51
// MISO: 12: 50
// SCK: 13: 52
...
Here is an example of connecting to an ATmega8 arduino:

Well, by analogy ... We are looking for a map of pins, for example, in the datasheet (technical documentation on MK) of the microcontroller we are interested in, here, for example, is the first link from Google for “ATmega8 pdf”.
Okay, I won’t torment anymore, here is a link to the program with files from the Arduino IDE .
Link to the thread on the Russian-language forum Arduino ;
Fusion calculator ;
ATtiny13 firmware and programming using Arduino ;
All my publications .
PS I had such that ATtiny13 stopped flashing, trying to program it, after I tried to run it at a frequency of 128 kHz, I dug up somewhere such a slightly modified ArduinoISP code which causes the firmware / change of fuses to occur several times slower and maybe some kind of magic, did not understand, honestly.