Arduino ISP (In System Programming) and stand-alone circuits

By on March 14, 2012

We use an Arduino to program other ATmega without bootloader . This technique allows you to use all flash memory for code and make boards using new ATmega, cheaper than those with bootloader.

The qualities that have made the success of Arduino are undoubtedly the open-source software, many libraries, a good hardware and a virtually infinite Reference that explains each possible use of the platform.

But if we use Arduino for a specific use, we can integrate it into a specific circuit and program the micro in a way that performs a single firmware. We may so remove the bootloader and leave to the firmware the entire program memory.

The ATmega328 has 32 Kbytes of flash, that when the chip is mounted on Arduino are not all available, as a portion is reserved to the bootloader, the purpose of which is to communicate with the IDE Arduino to load programs (sketch) to be performed. The same bootloader, on each power on or reset of Arduino, verifies the presence of a sketch in flash memory and executes it. The bootloader occupies a space of 512 bytes, in the case of Arduino UNO.

Well, in a stand-alone application the bootloader no longer needed.

The configuration of the micro ATmega328P needs, in addition to the power (+5 VDC to pins 7 and 20, GND to pins 8 and 22), a 16-MHz crystal between pins 9 and 10, two 22 pF ceramic capacitors from between these pins and GND, a 10 k Ω resistor between pin 1 and +5 VDC for pull-up the reset line.

 

Programming ATMEGA in stand-alone

Anyone knows that it is necessary program Arduino uploading a sketch via USB, using the software called IDE and the operation is quite simple.

We can see a screenshot of the IDE with an Arduino sketch loaded and UNO during the receipt of the sketch (notice the yellow LED on).

The technique will test allows the use of a board Arduino as ISP Programmer.

We start with the list of required materials:

•               Arduino UNO / Duemilanove (will be used as a programmer);

•               ATmega328P chip (chip to be programmed);

•               Breadboard and jumper;

•               a crystal of 16 MHz, two ceramic capacitors from 22 pF, a resistance of 10 K Ω 1/4 W, a resistance of 560 Ω 1/4 W LED 3 or 5 mm;

•               seven male-male jumper wires.

A resistance of 120 Ω 1/4 of watts, and an electrolytic capacitor or tantalum from 10 uF 10 ÷ 16 volts.


Now we prepare our target circuit and first of all insert the chip on the Breadboard, these are the connections to make:

•               through the jumper to be Breadboard connect pins 7 and 20 of the chip to the positive supply line (+5 volts);

•               in the same way we connect the pins 8 and 22 of the chip to the ground line supply (GND);

•               connect pin 1 of the chip to the +5 V line through the resistor of 10 k Ω;

•               insert the crystal to the pins 9 and 10 of the chip;

•               insert the two 22 pF ceramic capacitors; both must have a leg connected to GND, while the other will serve to connect a capacitor to pin 9 and the other to pin 10 of the chip;

•               insert one end of resistor 560 Ω at the pin 19 and the other end into an empty spot on the breadboard, and to this end we connect the anode LED(the longer pin) , whose other end (cathode) goes to GND;

 

At this point we can connect to the Arduino Breadboard using jumper cables under the following matches:

•               Arduino pin 10 goes to pin 1 of the chip;

•               Arduino pin 11 goes to pin 17 of the chip;

•               pin 12 of Arduino is connected to pin 18 of the chip;

•               pin 13 to Arduino pin 19 goes on the chip;

•               the +5 V pins of Arduino goes to the positive supply line of the breadboard;

•               any of the three GND pin of Arduino goes to the ground line of the breadboard.

 

Now look the software to reveal the “trick” that sends a sketch, using the IDE, to the chip on the Breadboard, bypassing Arduino that will play the role of Programmer ISP.

What we need to do is create a virtual board, starting from the original (corresponding to the model we are using Arduino) and making some simple but essential changes. We must first locate the file that is boards.txt containing all information relating to the various boards that the IDE shows us when we execute the command Tools->Board. Typically this file is located in the folder of the IDE software, the path X: \ mypath \ arduino-xxx \ hardware \ arduino, where X is the letter that indicates the logical drive and myPath the folder or location containing the program (xxx indicates the version of the program).

Now open the file with Notepad and see a long series of lines arranged in groups separated by a line consisting of a repetition of the symbol “#”,each group representing a different board. The lines are identified by the initial code, the same for all, but different for the board, the name that will appear in the submenu Tools->Board is inserted in the first row in the group.

The code is represented by the word “uno” which is at the beginning of each line.

The line containing the word “name” (usually the first) is followed by “=” and then the name that the board will have in the IDE.

Other information that concern us are:

uno.upload.maximum_size = 32256: Sets the maximum capacity of flash memory that we can use in practice from 32 Kbytes of Flash which has the total ATmega328P we must subtract the space occupied by the bootloader, for the Arduino UNO is 512 byte;

uno.bootloader.low_fuses = 0xffuno.bootloader.high_fuses = 0xdeuno.bootloader.extended_fuses = 0x05; these three lines are the “fuse”, are used to set the behavior of the chip and are expressed with hexadecimal values;

uno.build.f_cpu = 16000000L: This line must correspond to the clock frequency for which the chip has been set, by means of the fused, expressed in Hz, 1 Hz 6,000,000 correspond to 16 MHz, precisely the frequency of the quartz or, more precisely, the present external oscillator to Arduino UNO; this value is used as a reference for timing controls of the software, such as delay () and millis ().

 

And now we create our own virtual board, writing these lines of code:

 

atmsa16.name=ATmega in Stand Alone (w/ Arduino as ISP)
atmsa16.upload.protocol=stk500
atmsa16.upload.maximum_size=32768
atmsa16.upload.speed=115200
atmsa16.upload.using=arduino:arduinoisp
atmsa16.bootloader.low_fuses=0xff
atmsa16.bootloader.high_fuses=0xdf
atmsa16.bootloader.extended_fuses=0x05
#### atmsa16.bootloader.extended_fuses=0x07
atmsa16.bootloader.path=optiboot
atmsa16.bootloader.file=optiboot_atmega328.hex
atmsa16.bootloader.unlock_bits=0x3F
atmsa16.bootloader.lock_bits=0x0F
atmsa16.build.mcu=atmega328p
atmsa16.build.f_cpu=16000000L
atmsa16.build.core=arduino

 

Following the approach of the file will separate this group of lines to those of other boards, inserting a line of “#”.The end result should be:

We note that are varied: the code (atmsa16 instead of uno), the maximum_size (brought to its maximum capabilities of Flash, since we do not reserve space for the bootloader), then there a new line (atmsa16.upload.using = arduino: arduinoisp) that allows us to understand the IDE that will program the chip in stand-alone and not on the Arduino. Another new line is preceded by some “# # # #” that disables it, the reason is easily explained: the extended_fuses is set to 0x05, and in some special cases, during the transfer of the sketch could be an error bound the setting of this value.As we shall see later, simply change the following two lines of code:

 <em># # # # Atmsa16.bootloader.extended_fuses = 0x05</em>
<em>atmsa16.bootloader.extended_fuses = 0x0</em>7

thus activating the value 0x07 instead of 0x05, it will work out. Of course, this change should not be made before, but only if you get the error.

 

Program the micro

At this point we are ready for the final step: send our sketches to the chip mounted on the breadboard and then will test the operation separating it from Arduino.


To read the new board in the file, the IDE must be restarted, so if this program was open, when editing the file boards.txt must close it and restart it. To verify that our modification is successful, it is sufficient now run the command Tools->Board and check if there is now our “stand-alone” board, otherwise we should close the IDE and check the file boards.txt, because certainly we made ​​a mistake.

The technique used to send the sketch to the chip in stand-alone mode is very simple: First select the Arduino board that we are using as a programmer (eg Arduino Duemilanove or UNO) , just as we do for normal use of Arduino. Then select the Arduino serial port (the COM for Windows users) and recall from the IDE the sketch ArduinoISP, execute this command by clicking the Upload button on the IDE. After several seconds of the three flashing LEDs and Arduino to the breadboard of course (at the moment is physically connected to pin 13 of Arduino that, as we know, check out one of the three LEDs on the board) on the IDE will come the message “done uploading “.

Arduino is ready to play the role of Programmer ISP, select, now, our board IDE “ATmega Stand Alone (w / Arduino as ISP)“, without changing the COM.

We load the sketch “blink” and execute it again by clicking the Upload button on the IDE: LEDs and Arduino breadboard flash again, this time for a much shorter period, after which the IDE will show the message again “Done uploading”.

So our ATmega328P chip was programmed without having to physically fit on Arduino and now lives its own life. It is then ready to be mounted in the circuit which it is intended.

Of course, the chip can be reprogrammed at will with any kind of sketch.

 

Troubleshooting

At this point we have to solve three types of problem that may occur when we send the sketch to the chip stand-alone. The problems of’extended_fuses and of autoreset may occur on either Arduino Duemilanove or Arduino UNO, without that you can establish a certain rule.We must also emphasize that the remedies that will illustrate to 100% solve the problems, but must be applied only if the problem occurs.

We start from the situation that may occur if we use a blank chip, the Atmel set the fuse to make the chip work at 1 MHz with the internal oscillator. If we send a sketch directly, happens that the chip in stand-alone ignores the external crystal and times will be staggered: for example, the LED blink with the sketch will last about 16 seconds instead of 1 second. Simply, we set the fuse, the operation can be done easily by loading the bootloader on the chip before sending the sketch.

Before explaining this simple maneuver quickly clarify two points: the bootloader is sent once a chip virgin and will only serve to set the fuse, then it will become useless and the sketch overwrite it, if we had to first load the sketch, noticing the error, and then load the bootloader, no problem: the chip is set and we just have to resubmit the sketch. The simple steps that are going to describe will return very useful for cases where we wanted to prepare a blank chip to work directly on Arduino; is a good idea to have in the house a spare chip with bootloader of our board, so if you were unfortunately damaged the original, a simple substitution solves this problem immediately.

Here are the steps to follow:

•               prepare and connect the Breadboard Arduino as discussed previously;

•               We open the IDE and select the model we are using Arduino and port to which it is connected;

•               upload the sketch ArduinoISP to Arduino;

•               now execute the command Tools->Burn Bootloader w / Arduino as ISP;

•               After about a minute we loaded into the stand-alone chip the bootloader of Arduino boards (you may have noticed that in the IDE we’ve set our Arduino board).

 

As mentioned, the chip can be quickly mounted to receive the Arduino sketch, or leave it on the breadboard and repeat/execute the operation of sending the sketch stand-alone, this time the Blink will work perfectly.

Of course, other errors may occur, do not worry, keep reading this section and of course everything will be resolved.

So let the problem of ‘extended_fuses: the rows of our virtual board we expected a double value for this cast, because it can happen (even though it is quite rare) that some boards do not succeed in this program merged with the value 0x05. During the upload of the sketch on the chip with stand-alone mode, the IDE will display an error message (written in red on a black background) that will indicate the need to use the value 0x07, if it appears that in practice warning means that we must close the IDE, open the file boards.txt and activate the relevant line, simultaneously disabling the other (with 0x05), as explained above. At this point we can repeat the test. We clarify that if the error occurs on a given board will always occur on this board, so the variation of the files should be done only once and permanently.

And now we see the problem, more frequent, about autoreset. When the serial chip (FT232RL on Duemilanove or ATmega8U2 of UNO) receives a signal from the USB port, sends the reset pulse to ATmega328, who then prepares itself to receive Data. This operation corresponds to the one you make every time you press the button “RESET” on the Arduino.

If the data do not arrive or if the reset was made manually, the sketches in flash memory chip ATmega328 is executed. When Arduino is used as ISP Programmer can happen that, if the autoreset is sent too early, the upload operation fails. In this case the IDE returns the following error: “avrdude:stk500_getsync (): not in sync: resp = 0x15“.

The problem is solved by blocking the Autoreset. The 120 ohm resistance must be connected between the RESET pin of Arduino and +5 V, while the 10µF capacitor is connected with the positive pole to the RESET of Arduino and negative to GND.

With a jumper cable connect on Breadboard the RESET signal of Arduino.

The methods described should be used only if absolutely necessary.

Important note: the need to connect these components only when needed, is dictated by the fact that to load a sketch on the Arduino should autoreset, otherwise the upload will fail and we will get the error avrdude: stk500_getsync (): not in sync: resp = 0x00 – avrdude: stk500_disable (): protocol error, expect = 0x14, resp = 0x51, so if you see this error, know that you just have to “liberate” the pin “RESET” Arduino from the link with the Anti- autoreset.

[Thanks to Michele Menniti]

About Boris Landoni

Boris Landoni is the technical manager of Open-Electronics.org. Skilled in the GSM field, embraces the Open Source philosophy and its projects are available to the community.
  • Duncan

    Is there any reason why an Arduino Pro-Mini with a USB adaptor couldn’t be used for this project?

    I have those and want to program some ATMEGA 328s for instant start up of program code (i.e. without the bootloader delay)

    Thanks

  • Pingback: Arduino ISP (In System Programming) and stand-alone circuits | Open Electronics | Michal Vondráček

  • http://www.michelemenniti.it Michele Menniti

    Hello,
    You can use Arduino Pro Mini with a USB-Serial ISP Programmer for the function. But Arduino Pro-Mini must work at 5V and 16MHz. If you need help please ask.

  • Duncan

    Thanks

    I have a 5V/16MHz Pro-Mini…

    My idea was to build it into a small box with a ZIF socket on the top and a lead for in-circuit programming (If I can ever locate the 3×2 IDC connectors!!!)

    If I encounter problems I’ll be in touch and I’ll send you a photo when it’s built.

    Thanks again

    Duncan

  • http://www.michelemenniti.it Michele Menniti

    You can follow these instructions for connections to the ZIF:
    – connect pins 7 and 20 of the ZIF to the positive supply line (+5 volts) of your Arduino PRO-mini
    – in the same way we connect the pins 8 and 22 of the ZIF to the ground line supply (GND);
    – connect pin 1 of the ZIF to the +5 V line through the resistor of 10 k Ω;
    – insert the 16MHz crystal to the pins 9 and 10 of the ZIF;
    – insert the two 22 pF ceramic capacitors; both must have a leg connected to GND, while the other will serve to connect a capacitor to pin 9 and the other to pin 10 of the ZIF.
    At this point you can make your ISP connection with 6 wires:
    – pin 10 of Arduino goes to pin 1 of the ZIF;
    – pin 11 of Arduino goes to pin 17 of the ZIF;
    – pin 12 of Arduino is connected to pin 18 of the ZIF;
    – pin 13 to Arduino pin 19 goes on the ZIF;
    Now read carefully this article and the instructions for software

    Good luck! ;-)

    Prof. Michele Menniti

    PS: The Magazine “Elettronica In” in the current issue, has presented an excellent project for the construction of an ISP Programmer for Atmel mcu:

  • Duncan

    I read through the article earlier – presumably I need to use a different piece of code for the Pro-Mini rather than the examples that begin “uno.—“?

    I have to admit to being a little confused at this point – but it may become clearer when I actually have everything ready and have my brain aligned with Arduino again (I only “play” with it now and again).

    Duncan

  • 7Usam

    Great Work , but :/

    i have atmega168v and 8MHz crystal and arduino ide ver 1.0

    my change in board.txt

    atmsa16.name=ATmega in Stand Alone (w/ Arduino as ISP)
    atmsa16.upload.protocol=stk500
    atmsa16.upload.maximum_size=14336
    atmsa16.upload.speed=115200
    atmsa16.upload.using=arduino:arduinoisp
    atmsa16.bootloader.low_fuses=0xff
    atmsa16.bootloader.high_fuses=0xde
    atmsa16.bootloader.extended_fuses=0x05
    atmsa16.bootloader.path=optiboot
    atmsa16.bootloader.file=optiboot_atmega168_8.hex
    atmsa16.bootloader.unlock_bits=0x3F
    atmsa16.bootloader.lock_bits=0x0F
    atmsa16.build.mcu=atmega168
    atmsa16.build.f_cpu=8000000L
    atmsa16.build.core=arduino

    and start burn bootloader then output is

    avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
    avrdude: stk500_cmd(): programmer is out of sync

    what is the problem ?

  • http://www.michelemenniti.it Michele Menniti

    Hi 7Usam,
    IDE 1.0 has a ArduinoISP defective, the new versions (1.0.1-rc1 & rc2) should solve the problem, but they are still beta versions. If you can do a test with IDE 002 or 0023.
    A note on your virtual board: you have to set HFuse = “DD” and eFuse = “FC” or “04”. You can also work without 8MHZ crystal, with the internal oscillator: E2 = LF, HF = DD, EF = FC (or 04). Let me know the news.

  • 7Usam

    Hi Michele i just remove the resistor and led from pin 19 then burn bootloader using ide ver 22
    then work it :) , can i burn bootloader of usbasp to my stander alone chip using same method ? , i test other chip that have not a bootloader of arduino …. just for test uploading simple program like blink then uploading is done ! and the blink is work in that chip but slow , so why we burn bootloader on chip ?

  • http://www.michelemenniti.it Michele Menniti

    EXCELLENT! :D if you use a resistor with value 680ohm or greater, you can also leave the LED on pin 19.
    By way ISPs can program any MCU AVRDUDE.COND recognized by the IDE, but you need the “core” for his family.
    If you burn bootloader, you’ll also change the fuses on the MCU, and set the exact frequency. After this you can schedule a firmware and you’ll see that the LED flashes properly.
    If you program a MCU, without setting the fuse with burn bootloader, the oscillator works badly.
    Unfortunately I do not know USBASP.

  • 7Usam

    Thanks ;)

  • Pingback: electronique | Pearltrees

  • NukeTheMoon

    Hi,
    I got an error when i try to program my controler on breadboard with blink example.
    C:\Users\Maxime\Desktop\arduino-1.0.1-windows (1)\arduino-1.0.1\hardware\arduino\cores\arduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory
    Here is my board code:

    uno.name=Arduino Uno
    uno.upload.protocol=arduino
    uno.upload.maximum_size=32256
    uno.upload.speed=115200
    uno.bootloader.low_fuses=0xff
    uno.bootloader.high_fuses=0xde
    uno.bootloader.extended_fuses=0x05
    uno.bootloader.path=optiboot
    uno.bootloader.file=optiboot_atmega328.hex
    uno.bootloader.unlock_bits=0x3F
    uno.bootloader.lock_bits=0x0F
    uno.build.mcu=atmega328p
    uno.build.f_cpu=16000000L
    uno.build.core=arduino
    uno.build.variant=standard
    ##############################################################
    atmsa16.name=ATmega in Stand Alone (w/ Arduino as ISP)
    atmsa16.upload.protocol=stk500
    atmsa16.upload.maximum_size=32768
    atmsa16.upload.speed=115200
    atmsa16.upload.using=arduino:arduinoisp
    atmsa16.bootloader.low_fuses=0xff
    atmsa16.bootloader.high_fuses=0xdf
    atmsa16.bootloader.extended_fuses=0x05
    atmsa16.bootloader.path=optiboot
    atmsa16.bootloader.file=optiboot_atmega328.hex
    atmsa16.bootloader.unlock_bits=0x3F
    atmsa16.bootloader.lock_bits=0x0F
    atmsa16.build.mcu=atmega328p
    atmsa16.build.f_cpu=16000000L
    atmsa16.build.core=arduino

    I first tried:

    atmsa16.name=ATmega in Stand Alone (w/ Arduino as ISP)
    atmsa16.upload.protocol=arduino
    uno.upload.maximum_size=32768
    atmsa16.upload.speed=115200
    atmsa16.upload.using=arduino:arduinoisp
    atmsa16.bootloader.low_fuses=0xff
    atmsa16.bootloader.high_fuses=0xdf
    atmsa16.bootloader.extended_fuses=0x05
    atmsa16.bootloader.path=optiboot
    atmsa16.bootloader.file=optiboot_atmega328.hex
    atmsa16.bootloader.unlock_bits=0x3F
    atmsa16.bootloader.lock_bits=0x0F
    atmsa16.build.mcu=atmega328p
    atmsa16.build.f_cpu=16000000L
    atmsa16.build.core=arduino

    Have any idea on what could be the problem ? :S

  • http://www.michelemenniti.it Michele Menniti

    Hello, I have always worked with IDE 0022. In ArduinoISP IDE 1.0 did not work, but IDE 1.0.1 should work properly even if the procedure is different. Tomorrow I install IDE 1.0.1 on my PC, I’ll give you some tests and news.

  • http://www.michelemenniti.it Michele Menniti

    Now I noticed that, in your board, the “x” in the extended fuse byte is not x but a different character, why?
    Also on the board you have previously used the line:
    uno.upload.maximum_size = 32768
    must be
    atmsa16.upload.maximum_size = 32768

  • NukeTheMoon

    The different character was an error from a copy paste, I have no idea why the character changed.
    Also I’m new to the arduino environement, I used to program PICs controlers but I wanted to try arduino for it’s vast variety of shields and libraries so forgive my stupid mistake.

    I forgot to use the line atmsa16.build.variant=standard, that my code seems to need to work which yours doesn’t#, maybe because of the version.

    I’d like to thank you for your quick answer and the great tutorial.

  • NukeTheMoon

    I thought the whole ISP programmation was working but i just realised it doesn’t. When i launch a code to program on the stant alone controler (after i programmed the UNO in ARDUINO ISP) it program the UNO and not the controler on breadboard.

    I passed the whole day trying to figure out the problem…
    I’m using those board config:

    atmsa16.name=ATmega in Stand Alone (w/ Arduino as ISP)
    atmsa16.upload.protocol=arduino
    atmsa16.upload.maximum_size=32768
    atmsa16.upload.speed=115200
    atmsa16.upload.using=arduino:arduinoisp
    atmsa16.bootloader.low_fuses=0xff
    atmsa16.bootloader.high_fuses=0xdf
    atmsa16.bootloader.extended_fuses=0x05
    atmsa16.bootloader.path=optiboot
    atmsa16.bootloader.file=optiboot_atmega328.hex
    atmsa16.bootloader.unlock_bits=0x3F
    atmsa16.bootloader.lock_bits=0x0F
    atmsa16.build.mcu=atmega328p
    atmsa16.build.f_cpu=16000000L
    atmsa16.build.core=arduino
    atmsa16.build.variant=standard

    So when I use ATmega in Stand Alone (w/ Arduino as ISP) board in tools to program i still program the UNO. Any idea why?

  • http://www.michelemenniti.it Michele Menniti

    Hi, IDE 1.0.1 works differently than IDE 0022, it provides directly to program Arduino via ISP, so you should NOT add the line “arduinoisp”, but you must refer to the original board dell’IDE1 .0.1. Yesterday I did not test because I thought you had solved the problem. Tomorrow I will do some tests and I hope to show you the solution. Stay tuned;-)

  • http://www.diegotecnology.es Diego

    Hi! in first place, congratulation for your work!

    I need you to help me, i am working with atmega2313 and i connect my microcontroler according the datasheet and the pins (MISO, MOSI, SCK).
    I conect all the conexions, i think that all is correct.

    Also i burn the Arduino Isp in my board Arduino Uno and i downloaded a archive with boards.txt and cores, i change the fuses in the boards.txt, i think that its wrong.

    I need help becouse i don’t know to do yet for this microcontroler works.

    I’m sorry for my English becouse i’m spanish.

    Thanks in advance.

  • http://www.michelemenniti..it Michele Menniti

    Hello Diego, Thanks!
    You also connected to pin 10 of Arduino reset pin of 2313?
    You have connected the 10K resistor between pin and GND reset 2313?
    At what clock frequency you want to work on 2313?
    If the chip is a virgin before I suggest you try the original fuses (Low = 64, DF = High, = Extended FF), without using the crystal and external capacitors.
    If you do not have a bootloader for the 2313 test you by sending it directly to the sketch, but this can not change the values ​​of the cast, which is why you must use the original ones.
    Hola!
    PS: I am Italian, your English is fine as well, is like mine :-)

  • http://www.michelemenniti..it Michele Menniti

    @ NukeTheMoon
    Hello,
    I’m sorry but these days I had to work hard and I could not do the tests that I have promised. As soon as I can to make sure you write it here for updates.

  • http://www.diegotecnology.es Diego

    yes, i also connect the pin 10 and the resistor of 10k is between Vcc and Reset of 2313.

    If the resistor is between ground and reset the burn is bad.

    i copy you the boards.txt referent a attiny2313, maybe something is bad.

    attiny2313at8.name=ATtiny2313 @ 8 MHz (Oscilador interno)

    # The following do NOT work…
    # attiny2313at8.upload.using=avrispv2
    # attiny2313at8.upload.using=Pololu USB AVR Programmer

    # The following DO work (pick one)…
    # attiny2313at8.upload.using=arduino:arduinoisp
    # attiny2313at8.upload.protocol=avrispv2
    # attiny2313at8.upload.using=pololu

    attiny2313at8.upload.maximum_size=2048

    # Default clock (slowly rising power; long delay to clock; 8 MHz internal)
    # Int. RC Osc. 8 MHz; Start-up time: 14 CK + 65 ms; [CKSEL=0100 SUT=10]; default value
    # Brown-out detection disabled; [BODLEVEL=111]
    # Serial program downloading (SPI) enabled; [SPIEN=0]
    # Preserve EEPROM memory through the Chip Erase cycle; [EESAVE=0]

    attiny2313at8.bootloader.low_fuses=0x64
    attiny2313at8.bootloader.high_fuses=0xdf
    attiny2313at8.bootloader.extended_fuses=0xff
    attiny2313at8.bootloader.path=empty
    attiny2313at8.bootloader.file=empty2313at8.hex

    attiny2313at8.build.mcu=attiny2313
    attiny2313at8.build.f_cpu=8000000L
    attiny2313at8.build.core=tiny

  • http://www.michelemenniti..it Michele Menniti

    You’re right, I made a mistake in his haste, the r10k goes between reset and Vcc.
    You also connected to pin 10 of Arduino reset pin of 2313?
    Your board is completely wrong!
    If your tiny2313 is a virgin and if you’re using Arduino as programmer uses this board:

    ###############################################################################################
    attiny2313at1.name ATtiny2313 = @ 1 MHz (internal oscillator; BOD disabled)
    attiny2313at1.upload.using = arduino: arduinoisp
    attiny2313at1.upload.maximum_size = 2048
    attiny2313at1.bootloader.low_fuses = 0x64
    attiny2313at1.bootloader.high_fuses = 0xDF
    attiny2313at1.bootloader.extended_fuses = 0xFF
    attiny2313at1.bootloader.path = empty
    attiny2313at1.bootloader.file = empty2313at1.hex
    attiny2313at1.bootloader.unlock_bits = 0xFF
    attiny2313at1.bootloader.lock_bits = 0xFF
    attiny2313at1.build.mcu = ATtiny2313
    attiny2313at1.build.f_cpu = 1000000L
    attiny2313at1.build.core = tiny

    You burn tiny2313 directly without bootloader, it does not exist for this MCU.
    Let me know.

  • http://www.diegotecnology.es Diego

    My board was downloaded of http://code.google.com/p/arduino-tiny/downloads/list

    Your code give me a lot of mistakes.
    I don’t know that is the reason for it doesn’t work.

    i give you more information:

    – Software Arduino 1.0.1
    – Sketch that i try to burn: Blink
    – Pin 10 of Arduino to pin 1 of attiny2313
    – With my board, the burn was succesful without mistakes but doesn’t work

    I hope that you can help me! this is a puzzle! jeje

  • http://www.michelemenniti.it Michele Menniti

    OK, then use the last board of the core but WITHOUT replacing anything.
    My suggestions are for the 0022 IDE, as I said the other user I have not done tests with IDE 1.0.1
    Tiny2313 on the digital pin 13 corresponds to the physical pin 16, that’s where you connect the led through a R330-560ohm

  • http://www.diegotecnology.es Diego

    mmmm okei, i test your suggesion and i tell you with something.

    certainly, where do you see the digital pin assigned a phisical pin??
    Mayby, i can change the pin assigned.

    Thanks!

  • http://www.michelemenniti.it Michele Menniti

    Inside the tiny folder \ cores \ tiny here is the file that contains the pins.arduino.c pinature of tiny2313; values ​​”dxx” represent the digital pins, connecting the LED to a pin and uses in its digital pin blink.

  • http://www.diegotecnology.es Diego

    hi michele!! my attiny works yet!!! you have reason! the pins was the problem!! you are fantastic!!! thank you very much!!

  • http://www.michelemenniti..it Michele Menniti

    Hi Diego!
    I am very happy for you, congratulations!
    Michele

  • http://www.michelemenniti.it Michele Menniti

    @ NukeTheMoon:
    OK, I managed to make tests and to burn a ATmega328P with IDE 1.0.1.
    You follow these steps:

    0 – Add the file boards.txt these lines:
    ####################################################
    atmega3216.name ATmega328P = 16MHz
    atmega3216.upload.protocol = arduino
    atmega3216.upload.maximum_size = 32768
    atmega3216.upload.speed = 115200
    atmega3216.bootloader.low_fuses = 0xff
    atmega3216.bootloader.high_fuses = 0xDF
    atmega3216.bootloader.extended_fuses = 0xFF
    atmega3216.bootloader.path = optiboot
    atmega3216.bootloader.file = optiboot_atmega328.hex
    atmega3216.bootloader.unlock_bits = 0x3F
    atmega3216.bootloader.lock_bits = 0x0F
    atmega3216.build.mcu = atmega328p
    atmega3216.build.f_cpu = 16000000L
    atmega3216.build.core = arduino
    atmega3216.build.variant = standard

    Save and close the file. Open the IDE 1.0.1.

    1 – Set the board “Arduino UNO” and the corresponding COM / USB / DEV.
    2 – Set the programmer “Arduino as ISP”
    3 – Open the sketch “ArduinoISP” present in the samples and make upload to Arduino UNO
    4 – Now open the sketch “blink”
    5 – Set the board “ATmega328P 16MHz”
    6 – Run the command File – Upload Using Programmer

    If you want to load the bootloader instead of the sketch, you must only follow the steps 1-2-3, then:
    4 – Run the command Tools – Burn Bootloader.

    Keep in mind that:
    the micro leaves the factory to 1MHz, if you want to use it clocked at 16MHz must set the fuse, the only way to set the fuse is loaded BEFORE the bootloader and then send the sketch.
    Good luck!

  • Duncan

    Hi

    I finally found the time to build this and it seems to work fine on IDE 1.0.1.

    The Blink sketch was running slow and I realised that the ATmega328 was running at 1MHz.

    I tried burning the bootloader but it failed with the message:

    ***failed;
    avrdude: verification error, first mismatch at byte 0x0000
    0xff != 0x07
    avrdude: verification error; content mismatch

    I have Board set at ATmega328p = 16MHz and Programmer set to Arduino as ISP, then I clicked on Burn Bootloader.

    Am I doing something wrong or is this because I have burned the sketch first and it now cannot burn the bootloader?

    Can the situation be fixed?

    Thanks

  • http://www.michelemenniti.it Michele Menniti

    Hi Duncan, the situation can be fixed easily.
    1 – Replace the value in the virtual board: eFuse = FF with eFuse = 07
    2 – Save, then close and reopen the IDE 1.0.1
    3 – Burn the bootloader (REQUIRED!!!)
    4 – Upload blink, now everything should work.

    Follow the instructions for 1.0.1 which I wrote in my last post

    Let me know.
    Michele

  • Duncan

    Hi Michele

    That fixed the problem and it is now working correctly.

    I took the opportunity to look up Fuses but could not understand much of what I read. Is there a SIMPLE explanation somewhere that you could reccomend that would explain what they are and how to set them?

    If I want to run an ATmega328 without any external oscillator components (for an application that is not time-critical) can I just burn the sketch onto a blank chip without burning the bootloader first – as I mistakenly did before? I didn’t try unplugging the crystal to see if it continued working at 1MHz (8MHz with 1/8 prescaler set???).

    Regards and thanks

    Duncan

  • http://www.michelemenniti.it Michele Menniti

    Very good!
    The topic of fused is not difficult to understand but it is difficult to explain.
    I have published two articles on Electronics In Numbers (June and July / August 2012), in particular in the June, I explained very well the use of fused and lock bits. I recommend reading them.

    You can work at 1MHz or 8MHz but you ALWAYS burn the bootloader first and then the sketch.

    Hello
    Michele

  • Duncan

    Hi Michele

    Two problems:

    1) The programmer seems to have stopped working.
    I tried to burn another sketch over the Blink sketch.
    On plugging in the ATmega328 the LED on Pin 19 (digital 13) blinks at the one second rate of the Blink sketch and continues to do so after I hit Upload using Programmer – nothing changes.
    The IDE then reports “avrdude: stk500_getsync(): not in sync: resp=0x00″ and the ATmega328 continues to run the Blink sketch.

    Do I have to run “Burn Bootloader” before each and every upload of a sketch or something?

    2) I did a Google search for “Electronics in Numbers” but nothing showed up – can you provide a link to this please?

    Sorry to be so dumb!!!

    Duncan

  • http://www.michelemenniti.it Michele Menniti

    Hi Duncan,

    The error “avrdude: stk500_getsync (): not in sync: resp = 0x00″ indicates connection problems, double check that the wires and check the current COM port

    You do not have to run “Burn Bootloader” before every upload sketches but only when you set the fuse of the micro.

    You have to look “ElettronicaIn – Current Issue” in this same page, on the right frame

    Michele

  • Duncan

    Hi Michele

    I checked the wiring, I even tried a new USB cable – nothing…

    Then I had a flash of inspiration. I seperated the programmer from the Arduino and reprogrammed the Arduino with the Blink sketch – that worked ok. I then uploaded the ArduinoISP sketch again, reconnected the programmer and everything is working again.

    Do you have any idea what may have caused the Arduino to mess up its stored program?

    Given the trouble I am having understanding all of this in English, I don’t think your articles on Fuses are going to help me much in Italian – thank you anyway.

    Duncan

  • Duncan

    Hi Michele

    I have been programming ATmega328 chips for standalone projects at 16MHz (external crystal oscillator) without any problems but now I need to do some for Internal Oscillator at 1MHz and at 8MHz..

    Obviously I need to create two new entries in the “boards.txt” file (I was going to call the entries “atmega32801″ & “atmega32808″ and use “atmega32801.build.f_cpu=1000000L” & “atmega32801.build.f_cpu=1000000L” respectively), but I am totally confused about what settings to use for the fuses and other things.

    Also (I don’t actually need to do it yet) is it possible to program the chips without a bootloader to free-up space or am I doing that already with “maximum_size=32768″ and the references to the bootloader apply to the Arduino boad that is acting as the programmer?

    The boards.txt entry I am using at the moment is:

    atmega3216.name=ATmega328p = 16MHz Crystal
    atmega3216.upload.protocol=arduino
    atmega3216.upload.maximum_size=32768
    atmega3216.upload.speed=115200
    atmega3216.upload.using=arduino:arduinoisp
    atmega3216.bootloader.low_fuses=0xff
    atmega3216.bootloader.high_fuses=0xdf
    atmega3216.bootloader.extended_fuses=0x07
    atmega3216.bootloader.path=optiboot
    atmega3216.bootloader.file=optiboot_atmega328.hex
    atmega3216.bootloader.unlock_bits=0x3F
    atmega3216.bootloader.lock_bits=0x0F
    atmega3216.build.mcu=atmega328p
    atmega3216.build.f_cpu=16000000L
    atmega3216.build.core=arduino
    atmega3216.build.variant=standard

    Thanks

  • Duncan

    Whoops…

    That should have read…

    “atmega32801.build.f_cpu=1000000L” & “atmega32808.build.f_cpu=8000000L”

    (the curse of “cut and paste”)

  • Michele Menniti

    Hello Duncan, these boards allow you to program the micro and 1MHz to 8MHz with IDE 1.0.1 with the normal mode. The cast are already designed to use the entire flash memory for the application. But the first thing to do is always to load the bootloader, to set the fuse, then you can load the firmware, which will erase the bootloader.
    Let me know how the tests will be
    Michele
    ##############################################################
    mega3208.name=ATmega328P 8MHz internal clock
    mega3208.upload.protocol=arduino
    mega3208.upload.maximum_size=32768
    mega3208.upload.speed=115200
    mega3208.bootloader.low_fuses=0xe2
    mega3208.bootloader.high_fuses=0xdf
    mega3208.bootloader.extended_fuses=0x07
    mega3208.bootloader.path=optiboot
    mega3208.bootloader.file=optiboot_atmega328.hex
    mega3208.bootloader.unlock_bits=0x3F
    mega3208.bootloader.lock_bits=0x0F
    mega3208.build.mcu=atmega328p
    mega3208.build.f_cpu=8000000L
    mega3208.build.core=arduino
    mega3208.build.variant=standard
    ##############################################################
    mega3201.name=ATmega328P 1MHz internal clock
    mega3201.upload.protocol=arduino
    mega3201.upload.maximum_size=32768
    mega3201.upload.speed=115200
    mega3201.bootloader.low_fuses=0x62
    mega3201.bootloader.high_fuses=0xdf
    mega3201.bootloader.extended_fuses=0x07
    mega3201.bootloader.path=optiboot
    mega3201.bootloader.file=optiboot_atmega328.hex
    mega3201.bootloader.unlock_bits=0x3F
    mega3201.bootloader.lock_bits=0x0F
    mega3201.build.mcu=atmega328p
    mega3201.build.f_cpu=1000000L
    mega3201.build.core=arduino
    mega3201.build.variant=standard
    ##############################################################

    • Duncan

      Hi Michele

      Can I just confirm the steps involved – I think I am worried that I may overwrite the bootloader on the Arduino that is the programmer.

      To program a chip at 8MHz Internal Clock:-

      1) Set “Board” to “ATmega328P 8MHz internal clock”
      2) Set Comm Port
      3) Set “Programmer” to “Arduino as ISP”
      4) Click “Burn Bootloader”
      5) Load the Sketch
      6) Click “Upload Using Programmer”

      Yes?

      The programmer is now using a Duemilenove that blew its voltage regulator – as it is being powered only by 5V from the USB everything works fine (eventually I will replace the regulator).

      Sorry if I am appearing to be a bit stupid!!!

      Thanks

      Duncan

      • melrick nicolas

        where can i find the sample arduino isp sketch ???

        • http://www.michelemenniti.it/ Michele Menniti

          In the list of programs included in the IDE, name ArduinoISP

    • Guillem Freixanet

      Hello Michele, I’m working on a project in which I need to upload a program into brand new ATmega168V-10PU microcontrolers (that I’ve got straigth from Atmel). I have the arduino UNO with ATmega328 and the IDE using is 1.0.1.
      In order to do that I followed exactly what it’s explained in this page. I built the exact same circuit with the 16MHz crystal oscilator. Then I modified boards.txt (here I started to have doubts because my microcontroler is different to the one used here so I didn’t no what to change), then I upload the sketch ISP to the arduino UNO, next I set arduino as ISP and finally I load the blink example and tryied to programe my new ATmega168V-10PU microcontroler. It’s been a complete nightmare, because it doesn’t work. Giving messages like ” not sync”, “signature problemes”, …
      I’ve been trying to understand what may be going on and I have some ideas. Maybe it’s because this microcontroler are initially set to work with 8MHz inside oscilator, or maybe it’s because I’m using a 16MHz external oscilator while this microcontrolers can work up to 10MHz. Or maybe it’s because the boards.txt or the bootloader need to be different with this kind of microcontroler.
      I need some light here. Thanks a lot for your help!!!

      by the way, I forgot to tell you that I’m using the windows version of arduino.

      And last, I tryied to modify the fuse byts but non of this work for me… I’m not an expert and maybe I did it wrong.

      • http://www.michelemenniti.it/ Michele Menniti

        Hello Guillem,

        please do not write many times the same post, you need patience, the answer comes.

        The micro ATMEL leave the factory to work at 1MHz. To make them work at 16MHz is necessary to set the correct fuses. This operation can be done with the Arduino IDE, burning the bootloader in the micro, using a specific board. The board you find in this blog in response to Rohan. Here is the sequence of operations to do:

        1 – edit the file boards.txt inserting the board for 168 16MHz (don’t change!)

        2 – Upload ArduinoISP sketch in your Arduino

        3 – Make the connections between Arduino and breadboard ISP (or your circuit) with mega168 (ATTENTION! the MISO MOSI SCK pin must not be connected to other components of the circuit!)

        4 – select the new board with 168

        5 – run burn bootloader (even if you do not need, it is essential to set the correct fuses)

        6 – Now you can upload your sketch, you must not use the normal upload but the command File – upload with a programmer.

        Let me know.

        Best regards

        • Guillem Freixanet

          Thank you so much Michele for your answer, right now I’ll try what you say. However I still have two questions:
          1- do I have to put the 16MHz oscillator in the pcb or any other oscillator?
          2- what is the 168 bord that I have to use? And what changes do I have to do to it to adapt the fuse byts?

          Thanks so much! I’m not a micro expert so your help is very important to me!

          • http://www.michelemenniti.it/ Michele Menniti

            The tutorial of this blog is well done and correctly explain all these things before, you have to study it well, otherwise it becomes difficult to help you. You have to read the tutorial well, then you have to read my post updated to version 1.0.x IDE, then you have to read my post about the ATmega168 at 16MHz, you’ll see that everything will be clear

          • Guillem Freixanet

            I read all your posts before writing anything, but I’m not sure I can use the atmega 168 since my micros are 168V and they can only work up to 10MHZ and and also I’m not sure if the signature is the same. Isn’t it necessary that the burnimg micro and the programing one (arduino) are working at the same speed?
            Thank you so much Michele!

          • http://www.michelemenniti.it/ Michele Menniti

            The 168V model has the same fuse 168 to 16MHz (high fuse 0xDF means 8MHz or higher) but can not exceed 10MHz clock, I suggest you use an 8MHz quartz and two 15-18pF capacitors, so you have good compatibility with the times of the IDE.

            Best regards

          • Guillem Freixanet

            Finaly! today I’ve had been able to burn the bootloader into my micro!!! :-) thanks a lot for your help!
            Last question: now if I want to program, let’s say the blink example, it says to me that arduino can’t find pins_arduino.h… is it because the pins are differently numerated than with Atmega 328?
            thanks a lot!!!!

          • http://www.michelemenniti.it/ Michele Menniti

            Very well! To upload a sketch you always have to select the board to program the micro and you have to use the technique ISP and ISP connections. But you do not have to click on the UPLOAD button, you must instead use the command File – Upload Using Programmer and everything will be fine. But let me know if the timing of the blink are correct (1 second on, 1 second off). Best regards

  • http://www.facebook.com/ian.blundell.39 Ian Blundell

    Hi Michele

    I must be missing something, I can burn the bootloader no
    problem but when I try to upload a sketch ArduinoISP tries to upload using
    serial coms, it does not pull the reset on the breadboard and attempt to use the
    same method as it does when I burn the bootloader. How do I ensure that the
    sketch can be downloaded without rewiring the breadboard. I want to use in circuit programing not in circuit
    serial programming.

  • Michele Menniti

    Hi Ian,
    which IDE version are you using?
    You did both tests burn bootloader and upload sketches with the micro on-board?

  • http://www.facebook.com/ian.blundell.39 Ian Blundell

    IDE version 1.01, I found the problem the Sketch was set at 19200 and the board is 115200, correcting enabled me to upload a sketch. but now I have to burn the bootloader each time before it will run the sketch correctly although there are no errors reported by averdude.
    Thanks
    Ian

  • Michele Menniti

    I’ve never had problems with the baud rate.
    However, when you upload a sketch with the technique ISP bootloader is automatically deleted.
    You need to burn the bootloader just to change the fuses to the micro, then you can load the sketch as many times as you want.
    Are you following the additional info that I wrote in the post for version 1.0.1?

  • Lukas

    Dear Michele Menniti

    I am sorry to bother you, my problem seems much more basic than all the questions that you have had to answer here. I just started with the Arduino Uno R3 (and have no useful knowledge in electronics whatsoever). I work with IDE 0022 on a MacBook Pro and wanted to burn the bootloader on a ATMEGA328P-PU on a breadboard (my goal is to get sketches like blink on it, but it seems that I am far from it). I have tried many tutorials and collected all kinds of error messages, but since I like your tutorial the most, I decided to ask you the following questions:

    1) first of all: can I use your tutorial with my gear or am I already wrong here?
    2) using your first approach (ignoring the 10uF cap) produces the error message :

    avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override
    this check.

    (I am pretty sure my cables are connected in the same way as in your picture)

    3) also the approach with the extra 10uF cap and the modified virtual board does produce this error.

    I am sorry that I have no idea how to get further information where the problem might be. Do you have any suggestion what might go wrong?

    Thanks a lot for any comment! Most likely I am doing a very stupid mistake that I just cannot see.

    best regards,
    Lukas

    • Kaledawit Esmelealem

      Hi

      have you solve your problem I want to burn bootloader to blank Atmega328P-PU with Arduino uno r3 as ISP and which IDE version is compatible.
      Please help me I want to make arduino in breadboard

  • http://www.michelemenniti.it/ Michele Menniti

    Hi Lukas,
    you can burn the bootloader with your configuration. You must not use the 10μF capacitor and even the 120ohm resistor. You have to follow the Tutorial main, it’s for version 0022.
    The error you get depends certainly in connections. You want to email me a photo of your connections between Arduino and breadboard? Some boards choose to burn the bootloader?

    • lukas

      Dear Michele,

      Miraculously, after changing the cables and redoing
      all the connections, it works just fine. I am not sure what really
      changed, but I am most happy that it works. Thanks a lot for your help
      and all the effort to bring your knowledge to newcomers like me!

      Best regards,
      Lukas

      • Lukas

        Just found out what most probably was the problem (in case someone might use this): the microcontroller was not pressed hard enough into the breadboard, hence not all the legs had good contacts to the board. Most probably a beginners mistake..

        thanks again,
        L

        • http://www.michelemenniti.it/ Michele Menniti

          Hi Lukas,
          as I said these types of errors are recurring.
          Thank you for the feedback.
          Best regards
          Michele

  • Juliano Polito

    Another info: I’ve tried doing it using Arduino 0022 and it gives me the same error:

    avrdude: Device signature = 0x000000
    avrdude: Yikes! Invalid device signature.
    Double check connections and try again, or use -F to override this check.

    Thank you.

  • http://www.michelemenniti.it/ Michele Menniti

    Hello everyone, I appeal to all those who write to me.
    I can not give you an answer if you do not give me at least the following information:
    1 – operation that you’re trying to do (burn bootloader, upload sketch)
    2 – the IDE version you are using (0022 or 1.0.1)
    3 – rows of virtual boards you are using (for uploading sketch)
    Moreover, 80% of problems are caused by incorrect connection, should be carefully monitored.
    Finally you must remember that this tutorial is based on IDE 0022, if you use 1.0.1 (1.0 is inappropriate!) Please refer to my post directed @ NukeTheMoon.
    Thanks to all
    Michele Menniti

  • Juliano Polito

    Hi Michele, again!

    Solved it. After a good night sleep, I realized it was a connection problem. Basically I could not see that one of the crystal’s leg was not on pin 10, but on pin 11. I was 4 a.m. I’m really sorry for that, hope I did not take any of your time.

    I could now burn the bootloader and upload a sketch. I need to test it yet, but I’m very confident. And just for the info, although I tried with both 1.0.1 and 0022, after seeing the connection problem I did the upload using 1.0.1.

    Thank you a lot.

    Best regards,

    Juliano

    • http://www.michelemenniti.it/ Michele Menniti

      Hi Juliano,
      I am very happy, I know that many times you something wrong in the connections.
      I did not waste time, do not worry.
      Best regards
      Michele

  • melrick nicolas

    where can i find the sample isp sketch ??? or pls send me the sample to my email add..
    melricknicolas@yahoo.com
    tnx … :)

  • Nicola Romanò

    Hello Michele,

    I am trying to upload a sketch to an ATMega168 (with an external 16MHz clock), using an Arduino Uno. How would I setup the board.txt entry for it?

    thanks

    • http://www.michelemenniti.it/ Michele Menniti

      parli Italiano o preferisci che ti risponda in inglese?

      Ciao

      • Nicola Romanò

        Ciao Michele,

        italiano o inglese è lo stesso :-) puoi anche provare col francese se vuoi!

        • http://www.michelemenniti.it/ Michele Menniti

          Bien :-) si vous voulez que je vous donne une information complète, vous devez d’abord me donner des réponses:
          1 – Générique complet imprimé sur le microcontrôleur
          2 – Version IDE (en particulier la “famille” 002x ou 1.0.x)
          3 – Chargement se faire via bootloader ISP, croquis, ou les deux

          Scherzi a parte mi servono questi dati perché cambiano parametri e procedure: la sigla completa del micro da programmare (quella stampata sul micro stesso), la versione IDE che vuoi usare e inoltre devo sapere se ti basta caricare uno sketch o se devi far uso del bootloader. Ciao

          • Nicola Romanò

            Allora, trattasi di un ATMEL 1122 ATMEGA168A-PU. La versione IDE è 1.0.1. Il bootloader è già preinstallato, mi basta poter caricare uno sketch. Ho provato un po’ a modificare i parametri in boards.txt ma senza successo (in generale ottengo un errore “Invalid device signature”). Grazie mille!

          • http://www.michelemenniti.it/ Michele Menniti

            Dunque, la tecnica ISP ti permette di caricare il bootloader o di caricare uno sketch sovrascrivendo il bootloader; quindi nel tuo caso, con la tecnica ISP puoi caricare lo sketch ma cancelli il bootloader. Se il bootloader è di un Arduino predisposto per il 168 potresti provare a risolvere in modo molto più semplice. Ti indico i passaggi:
            1 – Scollega Arduino dal PC e togli il micro ATmega328P
            2 – Al suo posto (ATTENZIONE alla polarità ed ai pin!) inserisci il tuo ATmega168A-PU
            3 – Collega nuovamente Arduino al PC
            4 – Setta come board il modello: “Arduino NG or older w/ ATmega168″

            5 – Richiama il tuo sketch e fai un normalissimo UPload.

            In questo modo lo sketch si carica senza cancellare il bootloader.

            Se l’operazione non va a buon fine significa che il bootloader è una versione più recente, nel qual caso la cosa si complica, e devi rassegnarti a perdere il bootoloader (che poi non ti serve a nulla se devi usare il micro in stand-alone). In questo caso me lo dici che provo a prepararti una board specifica per il tuo micro.

            Buone prove!

            P.S: Se vuoi approfondire l’argomento scaricati la mia Guida:
            http://www.michelemenniti.it/VHD/Elettronica/GPAT_v4.pdf

          • Nicola Romanò

            Grazie mille per le preziose informazioni! Faccio un po’ di test nei prossimi giorni!

  • MichelP

    Hi, I have been successfully using your directions to program some Atmega328P (PDIP) on a few prototype boards. I would like now to use the same method on an Atmega328P TQFP on a custom PCB powered at 3.3V. The GND, Reset, SCK, MOSI and MISO pins can be wired to my Arduino Uno board, the target chip’s reset pin is tied to the 3.3V through a 10K resistor and I have a 16Mhz crystal with 2x22pf caps . Is there any reason I could not program the chip ? Anything I should do differently?

    Also, I noticed that I had to install the bootloader first in order to use the external crystal. I’m not sure I can burn the bootloader with this setup. Any suggestions ?

    Thanks!

    Michel

    • http://www.michelemenniti.it/ Michele Menniti

      Hi Michel,
      You may NOT program a circuit powered at 3.3 V with Arduino, which runs at 5V, will almost certainly damage it a result of
      differing logic
      levels. Then you
      must to use an
      adapter of
      logic levels or even the simple voltage dividers, to be implemented with two resistors.

      It ‘s normal that you had to first load the bootloader in your micro, in fact this is the only type of operation that allows you to modify its fuse.

      Best regards

      • MichelP

        Hello Michele,

        Thank you for the advice, I should have though about it as it totally makes sense. On top of it, I also realized that I cannot drive the chip at 16Mhz under 3.3V. I think I need to ssomewhat rethink my plans…
        Regarding the bootloader, thank you for confirming.

        Best Regards,
        Michel

  • Alf Zurbrügg

    Hy Michele

    I have a TiDiGino with fixed ATmega 2560 on Bord, i have 6 Pins on Bord like this video: http://www.youtube.com/watch?v=m7cnEldGPog.

    I have also a uno board.
    For upload a new bootloader witch Pins i need?
    From uno to TiDiGino.

    thx

    • http://www.michelemenniti.it/ Michele Menniti

      Hi Alf,

      TDG
      has a standard connector ICSP. For connections, you follow the attached figure. CN1 ISP Programmer is your TiDiGino.
      ICSP
      is your Arduino UNO ARDUINO
      The free wire connects pin 5 of ICSP connector of TiDiGino to digital pin 10 of Arduino UNO.
      For the software follow the instructions of the video.
      good luck
      Michele

    • Guest

      TDG
      has a standard connector ICSP. For connections, you follow the attached figure. CN1 ISP Programmer is your TiDiGino.
      ICSP is your Arduino UNO ARDUINO

      The free wire connects pin 5 of ICSP connector of TiDiGino to digital pin 10 of Arduino UNO.
      For the software follow the instructions of the video.
      good luck
      Michele

    • http://www.michelemenniti.it/ Michele Menniti

      Hi Alf,
      TDG has a standard connector ICSP. For connections, you follow the attached figure. CN1 ISP Programmer is your TiDiGino.
      ICSP is your Arduino UNO ARDUINO
      The free wire connects pin 5 of ICSP connector of TiDiGino to digital pin 10 of Arduino UNO.
      For the software follow the instructions of the video.
      good luck
      Michele

  • Simone Sormani

    Ho un problema, quando arrivo a fare “carica” con lo sketck del blink mi esce:
    “errore durante la compilazione”

    In file included from Blink.ino:10:

    C:Program Files (x86)Arduinohardwarearduinocoresarduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory

    • http://www.michelemenniti.it/ Michele Menniti

      Ciao Simone, il tuo è il tipico caso di utilizzo “misto” tra IDE002x e IDE1.0.x. Rimuovi ogni traccia della 002x e se stai usando delle librerie, aggiornale in questo modo:
      Al posto della riga:

      #include “WProgram.h”

      inserisci le righe:

      #if defined(ARDUINO)
      && ARDUINO >= 100
      #include “Arduino.h”
      #else
      #include “WProgram.h”
      #endif

      Fammi sapere.
      Ciao.

      • Simone Sormani

        io non sto usando librerie..

        Ho seguito la guida modificando il file boards.txt poi passando ad arduino ho fatto l’upload di “ArduinoISP” e poi aprendo il “blink” e tentando di caricare non va. non ho capito dove dovrei mettere quello che hai scritto tu…

        ho trovato su interntet gente che dice di aggiungere la riga:

        atmsa16.build.variant=standard

        Potrebbe essere la soluzione del mio problema?

        • Simone Sormani

          Ho notato anche che nello sketch di “ArduinoISP” c’è la voce:

          #include “pins_arduino.h”

          non potrebbe essere questo a causare gli errori?

          • http://www.michelemenniti.it/ Michele Menniti

            In effetti stai seguendo le istruzioni per IDE 0022 ma stai usando IDE 1.0.1. In uno dei miei interventi qui ho spiegato alla lettera all’utente NukeTheMoon come deve procedere. Se hai difficoltà scaricati la mia Guida dal link http://www.michelemenniti.it/Arduino_burn_bootloader.phpFammi sapere.
            Ciao

          • Simone Sormani

            No, sto usando IDE 1.0.5…

          • http://www.michelemenniti.it/ Michele Menniti

            è la stessa cosa….. le istruzioni per 1.0.1 valgono per tutte le versioni successive

          • Simone Sormani

            Ecco, ho seguito le istruzioni.. avviene si l’upload senza problema, ma il tempo è sfasato (il led rimane 24 secondi acceso e 24 spento con l’impostazione:
            delay(1000)

            quale può essere il problema?

          • http://www.michelemenniti.it/ Michele Menniti

            No, quello dipende dal settaggio dei fuse e dalla configurazione hardware. Devi PRIMA eseguire il caricamento del bootloader, in tal modo setti i fuse correttamente, poi carichi lo sketch, sempre via ISP, ma il micro deve essere correttamente configurato col quarzo ed i due condensatori

          • Simone Sormani

            mi esce questo:
            errore durante la scrittura del bootloader.

            ***failed;

            avrdude: verification error, first mismatch at byte 0x0000

            0xff != 0x07

            avrdude: verification error; content mismatch

          • http://www.michelemenniti.it/ Michele Menniti

            Nella board che stai usando sostituisci il valore dell’extended fuse, dovrebbe essere ff, metti 07 (zerosette)

          • Simone Sormani

            ok, Ora provo, ma poi devo reimpostare il valore ff ??

          • Simone Sormani

            Funziona! Grazie per l’aiuto. :)

          • http://www.michelemenniti.it/ Michele Menniti

            Ottimo! :-)
            Il fuse 07 lo puoi lasciare, non dovrebbe crearti alcun problema, tecnicamente per il micro ha lo stesso significato di ff, in quanto in realtà sono usati solo i primi tre bit, che vanno messi a 1, quindi vale 07; ff imposta a 1 anche quelli inattivi, ma a volte questa cosa il micro non la gradisce. Ciao.

          • Simone Sormani

            Dopo alcuni mesi, riprendo la discussione perchè credo di aver sbagliato qualcosa; ho scelto tipo di scheda:ATmega328P = 16MHz che ha questa configurazione:
            ####
            atmega3216.name=ATmega328P = 16MHz
            atmega3216.upload.protocol = arduino
            atmega3216.upload.maximum_size = 32768
            atmega3216.upload.speed = 115200
            atmega3216.bootloader.low_fuses = 0xff
            atmega3216.bootloader.high_fuses = 0xDF
            atmega3216.bootloader.extended_fuses = 0x07
            atmega3216.bootloader.path = optiboot
            atmega3216.bootloader.file = optiboot_atmega328.hex
            atmega3216.bootloader.unlock_bits = 0x3F
            atmega3216.bootloader.lock_bits = 0x0F
            atmega3216.build.mcu = atmega328p
            atmega3216.build.f_cpu = 16000000L
            atmega3216.build.core = arduino
            atmega3216.build.variant = standard

            #####

            Ora, dopo aver aperto lo sketch, devo caricarlo con il programmatore “Arduino as ISP” o con “AVRisp mkII”?

          • http://www.michelemenniti.it/ Michele Menniti

            Io ormai ho perso il filo…. comunque come programmatore devi settare quello che hai; se stai usando UNO+ArduinoISP ovvio che setti Arduino as ISP, se invece stai usando un programmatore vero devi usare la sua sigla. COmunque sia per caricare lo sketch via ISP NON devi usare il comando UPLOAD (carica) bensì File – carica con un programmatore, naturalmente mantenendo settata la board virtuale che hai creato in precedenza (a proposito togli il simbolo “=” prima della dicitura 16 MHz. Ciao

          • Simone Sormani

            seguo la procedura del pdf di pag. 56-58?

          • http://www.michelemenniti.it/ Michele Menniti

            Il condensatore va messo solo in un caso ben preciso, il cui errore è chiaramente scritto nella guida, altrimenti è prova persa. La board che stai usando va bene SOLO se i fuse del micro sono già settati con i valori FF-DF-07, in caso contrario devi prima caricare il bootloader con quella stessa board (e le specifiche istruzioni) per settare i fuse e poi puoi caricare lo sketch.

          • Simone Sormani

            I chip che intendo programmare sono vergini.. uso lo stesso schema di questo articolo con l’IDE 1.0.5
            Mi potresti dare il link per la guida con l’IDE 1.0.5?

          • http://www.michelemenniti.it/ Michele Menniti

            non ho scritto una guida più aggiornata, ma 1.0.1 va bene per 1.0.5. Se non leggi bene la guida ti sfuggiranno sempre dei passaggi. Fondamentalmente prima bisogna settare i fuse e lo fai caricando il bootloader, poi puoi caricare via ISP qualsiasi sketch.

          • Simone Sormani

            Ho scaricato l’ultima versione della guida(la 4a edizione) e mi sono letto bene le prime 60 pagine, appena ho un attimo leggo le ultime(seppur non servano al momento).Sono riuscito a programmare l’atmega328p correttamente. Grazie di tutto.

          • http://www.michelemenniti.it/ Michele Menniti

            Quindi tu stavi usando la vecchia Guida? La mia risposta è dipesa dal fatto che la 4a edizione è di oltre un anno fa. Comunque sono contento che tu abbia risolto, come vedi avevo ragione, bisognava solo leggere attentamente ;-) Ciao

          • Simone Sormani

            hai fatto un bellissimo lavoro con quella guida. Grazie ancora.

  • Rohan

    Hello
    I would like to program a atmega168 chip by following your method. Right now I have arduino mega 2560 to be used as ISP. Can you please say if I need to change any value of the code that I have to paste in the boards.txt like “upload.maximum_size” or any fuse value? (as it has 16KB of memory instead of 32KB of the atmega328)
    And do I need to do anything else as I would be using Mega as ISP?

    Thanks
    Rohan

    • http://www.michelemenniti.it/ Michele Menniti

      Hello Rohan
      you must describe me how you want to set the clock of the micro ATmega168, otherwise I can not give you a correct answer. Arduino MEGA is fine as ISP programmer, but the connections are different, are well described in the opening lines of the sketch Arduino ISP

      • Rohan

        Thanks for your reply. I would be using the atmega 168 with 16mhz crystal.
        Out of curiocity I would also like to know what changes to make if I use it at its internal clock ie. @ 8mhz.

        • http://www.michelemenniti.it/ Michele Menniti

          Hello,
          for 16 MHz external crystal, you must use this board:
          atm168_16.name = ATmega168 Stand Alone 16MHz external
          atm168_16.upload.protocol = arduino
          atm168_16.upload.maximum_size = 16384
          atm168_16.upload.speed = 19200
          atm168_16.bootloader.low_fuses = 0xff
          atm168_16.bootloader.high_fuses = 0xDF
          atm168_16.bootloader.extended_fuses = 0x07
          atm168_16.bootloader.path = atmega
          atm168_16.bootloader.file = ATmegaBOOT_168_ng.hex
          atm168_16.bootloader.unlock_bits = 0x3F
          atm168_16.bootloader.lock_bits = 0x0F
          atm168_16.build.mcu = ATmega168
          atm168_16.build.f_cpu = 16000000L
          atm168_16.build.core = arduino
          atm168_16.build.variant = standard

          For with 8MHz internal oscillator, you must use this board:
          atm168_8.name = ATmega168 Stand Alone 8MHz internal
          atm168_8.upload.protocol = arduino
          atm168_8.upload.maximum_size = 16384
          atm168_8.upload.speed = 19200
          atm168_8.bootloader.low_fuses = 0xe2
          atm168_8.bootloader.high_fuses = 0xDF
          atm168_8.bootloader.extended_fuses = 0x07
          atm168_8.bootloader.path = atmega
          atm168_8.bootloader.file = ATmegaBOOT_168_ng.hex
          atm168_8.bootloader.unlock_bits = 0x3F
          atm168_8.bootloader.lock_bits = 0x0F
          atm168_8.build.mcu = ATmega168
          atm168_8.build.f_cpu = 8000000L
          atm168_8.build.core = arduino
          atm168_8.build.variant = standard

          Remember
          to change the fuse you must first perform a burn bootloader on the micro, you can later upload the sketch, through ISP technique.

          Best regards

          • Rohan

            Thanks a lot sir.

  • JasSi

    Hi Michele,
    I want to try something similar. I have a bunch of ATmega16 &
    ATmega 32 (40-pin DIP), and I want to use Arduino IDE with it, to
    program them for various projects related to robotics (Like-
    taking
    readings from a bunch of sensors, driving DC motors and servos,
    that
    kinda stuff). I also have a USBASP programmer (10 pin out, like the one seen here- http://cloud7.lbox.me/images/384×384/201208/usbasp-usbisp-3-3v-5v-avr-programmer-usb-atmega8-atmega128_vmhzyt1346398689726.jpg) but don’t
    have access to an Arduino Uno or other boards.

    How can I use the Arduino IDE with the ATmega32?

    What files of the IDE need changing?
    Is there another programmer (hardware) that is better for this? What is the use of FT232RL USB to Serial break-out board from Sparkfun (http://www.sparkfun.com/products/718), and is it necessary?

    Also, what
    else do I need (hardware and/or software) to connect the ATmega32
    to a
    computer to

    1. upload Arduino sketches onto it, and

    2. be able
    to use the Serial.read and write commands?

    I have the latest
    Arduino version- 1.0.5

    I’m kinda new to Arduino so it would be
    great if you could tell me the step by step process and the
    necessary
    hardware pin connections too. Can you help?

    Thanks.

    • http://www.michelemenniti.it/ Michele Menniti

      Hi JasSi,

      a micro AVR can be programmed with an ISP programmer (what you already have) or using the Arduino sketch ArduinoISP or through a USB-to-serial converter (such as Sparkfun). But in the latter case the micro must have on board a firmware called “bootloader”.

      To program a micro AVR via ISP technical and Arduino IDE requires two basic things:

      1 – the technical characteristics of micro, written to the file AVRDUDE.CONF

      2 – a “core” specific to the IDE. The core contains all the information that allows the dialogue between IDE and micro.

      I studied everything for you and I can give you this information:

      1 – AVRDUDE.CONF the file that contains both ATMEGA16 ATMEGA32

      2 – there is no core to these micro official but you can read this link: http://retrointerfacing.com/?p=30=1

      3 – they have the same pinature Micro ATmega644, so you can search and download everything you need for the 644 and then change to the board the only micro turning it into ATMEGA32 (or 16).

      Best regards

  • Guillem Freixanet

    Hello Michele, I’m working on a project in which I need to upload a program into brand new ATmega168V-10PU microcontrolers (that I’ve got straigth from Atmel). I have the arduino UNO with ATmega328 and the IDE using is 1.0.1.
    In order to do that I followed exactly what it’s explained in this page. I built the exact same circuit with the 16MHz crystal oscilator. Then I modified boards.txt (here I started to have doubts because my microcontroler is different to the one used here so I didn’t no what to change), then I upload the sketch ISP to the arduino UNO, next I set arduino as ISP and finally I load the blink example and tryied to programe my new ATmega168V-10PU microcontroler. It’s been a complete nightmare, because it doesn’t work. Giving messages like ” not sync”, “signature problemes”, …
    I’ve been trying to understand what may be going on and I have some ideas. Maybe it’s because this microcontroler are initially set to work with 8MHz inside oscilator, or maybe it’s because I’m using a 16MHz external oscilator while this microcontrolers can work up to 10MHz. Or maybe it’s because the boards.txt or the bootloader need to be different with this kind of microcontroler.
    I need some light here. Thanks a lot for your help!!!

    • Guillem Freixanet

      by the way, I forgot to tell you that I’m using the windows version of arduino.

      And last, I tryied to modify the fuse byts but non of this work for me… I’m not an expert and maybe I did it wrong.

  • Sid

    Hello

    I have set up everything as described above. I am using an ARDUINO MEGA as ISP to program a 328 chip on breadboard with 16mHz crystal. I bought the 328 chip from market and flashed the bootloader (as it was virgin!). Now when I try to upload the Blink sketch an error message pops up saying

    In file included from Blink.ino:10:
    E:Installed Softwaresarduino-1.0.5hardwarearduinocoresarduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory

    This error is showing every time I try to upload any sketch.

    Can you please help me with the problem and how to solve it?

    • http://www.michelemenniti.it/ Michele Menniti

      Which bootloader do you have loaded in the micro?
      Which board did you use to load the bootloader?
      Which board are you using to load the sketch?

      • Sid

        Q: Which board did you use to load the bootloader?

        Ans: I used Arduino Mega 2560 to load the bootloader in the Atmega328.

        Q: Which board are you using to load the sketch?

        Ans: I’m using the same Arduino Mega to load sketch.

        Q: Which bootloader do you have loaded in the micro?

        Ans: I have no idea which bootloader I flashed but I can say exactly what I did to flash bootloader in new chip. Here is what I did:

        1. Loaded the Arduino ISP sketch from example.

        2. Flashed it into the Mega.

        3. Then Tools>Board>Atmega in Stand Alone.

        4. Tools>Serial Port>COM8 (its the COM port for the Mega)

        4. Then Tools>Programmer>Arduino as ISP

        5. Then Tools>Burn Bootloader

        I flashed the bootloader in this way 3-4 times and everytime the led
        flashed, that you told to connect to pin 19 of the 328 chip with a
        resistor. After burning bootloader it said “Uploading Bootloader
        Complete”.

        Now can you tell what is wrong?
        Thanks

        • http://www.michelemenniti.it/ Michele Menniti

          The correct
          procedure is:
          Select Arduino MEGA and select the COM port to which it is connected
          open ArduinISP
          upload ArduinoISP on Arduino MEGA
          Select Arduino UNO (COM remains to Arduino MEGA)
          Tools –
          Burn Bootloader

          With this operation, the stand-alone micro 328P is loaded Arduino UNO bootloader. Then mount it on Arduino UNO, Arduino UNO connects to the USB port, select Arduino UNO and the new USB port and make a normal UPLOAD, in this way should work.

  • davidhengo

    Hi Michele, i follow the step that you describe above about burning a bootloader to the atmega16, after i try to burn the bootloader appears this message.

    avrdude: Expected signature for ATMEGA328P is 1E 95 0F
    Double check chip, or use -F to override this check

    Can you help me to solve this problem, please ?

    • davidhengo

      i tried with the version 022 and 1.0.1 IDE

      • davidhengo

        now i got the following error:

        avrdude: Yikes! Invalid device signature.
        Double check connections and try again, or use -F to override
        this check.

        i´ve read the questions that other users made you and it seems to be a conection problem but i´ve checked several times with no succes!

        Best regards

        • http://www.michelemenniti.it/ Michele Menniti

          Hi David, I see too much confusion in your messages and in the errors.
          You must completely erase IDE 0022 and works only with IDE 1.0.1.
          I need info:
          Which Arduino board are you using as a programmer?
          Which micro are you planning?
          Which clock must have the micro after programming?
          What virtualboard are using, in the file boards.txt?
          You must re-check all connections well.
          Best regards

          • davidhengo

            Hi Michele

            Which Arduino board are you using as a programmer?
            Arduino uno RV3

            Which micro are you planning?
            ATMEGA16A

            Which clock must have the micro after programming?
            16MHz

            What virtualboard are using, in the file boards.txt?
            atmsa16.name=ATmega in Stand Alone (w/ Arduino as ISP)
            atmsa16.upload.protocol=stk500
            atmsa16.upload.maximum_size=32768
            atmsa16.upload.speed=115200
            atmsa16.upload.using=arduino:arduinoisp
            atmsa16.bootloader.low_fuses=0xff
            atmsa16.bootloader.high_fuses=0xdf
            atmsa16.bootloader.extended_fuses=0x05
            #### atmsa16.bootloader.extended_fuses=0x07
            atmsa16.bootloader.path=optiboot
            atmsa16.bootloader.file=optiboot_atmega328.hex
            atmsa16.bootloader.unlock_bits=0x3F
            atmsa16.bootloader.lock_bits=0x0F
            atmsa16.build.mcu=atmega328p
            atmsa16.build.f_cpu=16000000L
            atmsa16.build.core=arduino

            Re-check all connections well
            Done.

            Best Regards!

          • http://www.michelemenniti.it/ Michele Menniti

            Unfortunately you can’t program an ATmega16 with virtualboard ATMEGA328P (atmsa16.build.mcu = ATMEGA328P). To program a micro must have the core for Arduino, so you have to look on the Internet if it exists. Otherwise you can program the micro only using the software ATMEL STUDIO 6.

            Best regards.

          • davidhengo

            your right! after hours of internet surfing i found this web page, where explained me a lot questions that i had.

            maybe your tutorial could be better adding some information.

            please take a look.

            http://hardwarefun.com/tutorials/use-arduino-code-in-non-arduino-avr-microcontroller

            thank you very much by supporting the people who really want to grow up in this electronic world. My problem has been solved, i finally could upload a program to an atmega16a.

            Have a nice day.

            David.

  • Kaledawit Esmelealem

    Hello
    I need to burn the Atmega328p-pu with arduino uno r3, and arduino 1.0.5 IDE
    When i try to upload the Arduino ISP sketch, Error happen this is

    avrdude: stk500_getsync(): not in sync: resp=0x00
    please help me I follow the instruction in the above and other fourm

    my email kaledawitesmelealembd(at)gmail,com

    • http://www.michelemenniti.it/ Michele Menniti

      Hello,
      the instructions that are in the blog related to the IDE0022. If you read the post you’ll find the upgrade instructions for IDE 1.0.x There are significant changes that affect the board and the virtual IDE commands.
      Best regards

  • linton

    hello michele i’m linton please help arduino programing softwere ?

    • http://www.michelemenniti.it/ Michele Menniti

      Hello linton,
      I’m sorry but this blog covers only the technical ISP, you should subscribe to the official Arduino Forum, where you will find a lot of people ready to help you.
      Best regards

  • linton

    sir

  • linton

    sir

  • Govardhana Chary

    thanks alot

  • Chirantan Kansara

    Hi Michele,

    I am following the first approach. Every thing worked fine up till uploading an ISP program to the microcontroller on the Arduino board. Further while trying to upload on the the Microcontroller on the bread board I m getting ‘ Error compiling’ saying with further description as ‘C:Program Filesarduino-1.0.1-windows(1)arduino-1.0.1hardwarearduinocoresarduino/Arduino.h:213:26: error: pins_arduino.h: No such file or directory ‘.
    The microcontroller on the Arduino board is Atmega328P-PU while that on Breadboard is ATmega328-PU. Firstly, I thought this may be due difference in the device signatures but not sure as the error description does not say so. I didnot alter any of the Device signatures therefore. Am not getting whats the exact matter is. I am using IDE version 1.0.1

    • http://www.michelemenniti.it/ Michele Menniti

      Hi ,
      the instructions are for IDE0022, if you are using IDE1.0.x look in my post, I explained the differences. The ATmega328 is very different from the P type and its programming must change the configuration file AVRDUDE and create a specific board. It is NOT a very simple operation.

      • Chirantan Kansara

        Hi,
        Thanks for the immediate and kind response. I some how solved the above mentioned problem, for that I copied the file(notepad format) named ‘ pins_arduino ‘ in location ‘C:Program Filesarduino-1.0.1-windows(1)arduino-1.0.1hardwarearduinocoresarduino’.
        and got a clear way up till oading program onto the breadboard microcontroller. On uploading the blinking program I got the message ‘ Done uploading ‘ without any errors. But on setting the preferences in the file menu, I saw in the comment menu ‘ avrdude device signature=0x000000
        avrdude Yikes! invalid device signature
        and it tells to double check the connections and to override ‘ something ‘ with _F something sort of that and the microcontroller on bread board does not blink the LED connected to the pin 19 although I have got the message ‘ Done uploading ‘ without any errors. So please suggest some solution I am not getting what exactly the problem is.

        • http://www.michelemenniti.it/ Michele Menniti

          HI, I’ve already given you the answer, the 328 and 328P are micro different from them, but unfortunately it is not easy to provide all the numerous steps to solve the problem. I recommend having a search on the net. I am sorry.

          • Chirantan Kansara

            Thanks, I will try to sort out the problem.

          • Chirantan Kansara

            Hi Michele,
            Thanks for the previous help. I want to know , if all the arduino boards with different micros have the same bootloader or the different bootloader, if they have different bootloaders, in what aspects the bootloaders are different

          • http://www.michelemenniti.it/ Michele Menniti

            Hi, The bootoader is specific for each type of MCU, but is not necessary. It only need if you want to update the firmware via serial communication. The technique ISP allows you to upload a firmware in the micro even without the bootloader. Instead it is essential to get the core; the core is a set of information about each type of MCU and serves to allow proper interfacing with the MCU Arduino IDE.

          • Chirantan Kansara

            so in this reference I would like to ask, is it possible to upload a program in MCU ARM (anytype) through Arduino UNO which has ATmega 328?

          • http://www.michelemenniti.it/ Michele Menniti

            I am referring to the families ATmega and ATtiny, I have not done tests with ARM

          • Chirantan Kansara

            Dear Michele,
            Kindly tell me the device signature for atmega 328 P-AU

          • http://www.michelemenniti.it/ Michele Menniti

            1e 95 0f ATmega328P-XX (all models) recognized by the Arduino IDE

            1e 95 14 ATmega328-XX
            (all models) not recognized by the Arduino IDE

          • Chirantan Kansara

            Thanks….

          • Chirantan Kansara

            Sir, recently got success in bootloading the previously discussed ICs. Thanks a lot for your kind help and guidance. Please let me know if I can interface a sensor whose output is 4-20 milliamps to ATmega 328 ADC channel or i will need any sort of conversion.

          • http://www.michelemenniti.it/ Michele Menniti

            Did you mean millivolts, I think so, but this question is not connected to the topic.
            Best regards

          • Chirantan Kansara

            I know this question is not connected, but while working with arduino I came to point where I am needed to interface a Sensor whose output is in terms of current variation so, is it possible.

          • http://www.michelemenniti.it/ Michele Menniti

            OK, It is not possible to read to a variation in the current Arduino, you must convert it into voltage variation, perhaps by running current through a precision resistor and applying Ohm’s law.

          • Chirantan Kansara

            Thanks… your suggestion and guidance has always helped me to improvise. I have to connect xbee module to arduino without using xbee shield, I know that xbee works on 3.3v and its power supply should regulated from arduino 5v to 3.3v but do i need to regulate the arduino’s Tx and Rx lines to 3.3v so that they can be connected to arduino or thay can be directly connected to the xbee module. if they have to be regulated to the 3.3v then what should be the approach for doing so.

  • Vitor

    Hello Michele Menniti,
    Thanks for your very good post.
    I can use your tutorial but i have a Arduino Mega.
    I can use a Arduino Mega for this tutorial?
    I need change something in board.txt or i can use your example?
    I will use a ATmega328 for my standalone

    • http://www.michelemenniti.it/ Michele Menniti

      Hi Vitor,
      you can use to program the Arduino MEGA ATmega328P in stand-alone mode.
      You do not have to change the file boards.txt.
      You just have to change the ISP connections:
      MEGA pin 53 to pin 1 of 328
      MEGA pin 52 to pin 19 of 328
      MEGA pin 51 to pin 17 of 328
      MEGA pin 50 to pin 18 of the 328
      Best regards

      • Vitor

        Ok Michele, thanks!
        Best regards!

  • alfadex

    Hello Sir. I have Arduino uno R1.i follow all your steps ,i set fuses as you mention

    0xff , 0xdf , 0x05 and at the end it says burn bootloader done !

    Now i take off the original 328p from arduino, and i place the one that i just burn the bootloader.

    I upolad the scetch ”Blink” , at the end it says

    ”avrdude done. Thank you ” without any problems, but led at pin 13 is not blinking!!!

    Even if it says ”avrdude done. Thank you ”no of scetch that i upload works

    I think everything is ok , but doesn’t work!

    • http://www.michelemenniti.it/ Michele Menniti

      Hello alfadex,
      you do not have to use a virtual board, you must repeat the burn bootloader directly using the Arduino UNO board.

  • Pingback: ISP | Pearltrees

  • Pingback: Arduino ISP (In System Programming) and stand-a...

  • heron

    Will this work with the latest version of the arduino ide? (1.0.5)

    • http://www.michelemenniti.it/ Michele Menniti

      Ciao Giuseppe,
      ti ho visto presente sul Forum Italiano, potevi chiedere anche lì. La risposta è positiva, ma l’articolo riguarda la versione IDE0022, però se cerchi nelle mie varie risposte in questo blog ne trovi una che spiega come applicare la tecnica con IDE 1.0.x, che ovviamente vale anche per 1.0.5.
      A presto.
      Prof. Michele Menniti

  • Christine Compton

    can someone tell me what this is used for. I just happened on this website and can’t make heads or tails. Just wondering. Thanks

    • BorisLandoni

      Please read the article to find the answer ;-)