ATmega DIP40 in Arduino IDE 1.6.4

Quick solution for use some ATmega microcontrollers (DIP40) in newer Arduino IDE ver. 1.6.4

  • Version 1.0.0 support for ATmega1284, ATmega32 and ATmega16
  • Version 1.0.1 added support for ATmega1284P and ATmega644 (in progress)
Step 1: Select Preferences
Step 2: Edit field Additional Boards Manager URLs
Step 3: Open Board Manager
Step 4: Install boards
Step 5: Done
Step 6: Only for ATmega32 and ATmega16
we need to edit file:
and change:


Add a Comment
  1. Hi, this is a really great thing to add support for Atmega32. I only have a problem when uploading sketches. The IDE does not find my Atmega32 Board. Serial is ok, as I testeed with IDE short circuit of RXD and TXD, but I always get a Timeout

    Using Port : COM4
    Using Programmer : stk500v1
    avrdude: stk500_recv(): programmer is not responding
    avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x03
    avrdude: stk500_recv(): programmer is not responding

    As I’m not using a stk500v1, just a serial connection, what should I adjust in IDE 1.6.4?

    Thank you

    1. This setup is designed to be used with a programmer(like USBASP), not with bootloader (ie not working with serial connection).

      The easiest is to connect a USBASP(to computer and to atmega) and select Tools->Programmer->USBASP. And will work without any problems.

      Why I did in this way?
      To put a bootloader in ATmega still need a programmer… not only to put a bootloader, but also to set fusebits according with this … And some flash memory would be occupied by bootloader.

      So I decided not to use at all bootloader(uploading via serial). A USBASP is cheaper than a standalone microcontroller in retail shops(and has an Atmega8 inside).

      When you use an Arduino board, microcontroller is already configured/programmed with the bootloader and fuse bits. But when you use a new(blanc) microcontroller you have to do these steps on your own.

      So for simplicity, and the fact that we need a programmer anyway, I got rid the bootloader…
      But still is needed to set fusebits at first use.

      you can read about fusebits here:

  2. hi
    i downloaded the json
    still same problem
    it looks like a problem of the ide !!
    serial baud has same defect !
    what can i do ?

    1. Fusebits are set ok? It’s the only thing I was thinking …
      Or usb to serial adapter…

      For me, I solved the problem with serial with changes in HardwareSerial.cpp

  3. I download the json,some problems encountered in the use of.

    void loop() {
    //│When this pin is 31, the output can be right.│
    digitalWrite(31, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(31, LOW); // turn the LED off by making the voltage LOW
    delay(1000); // wait for a second

    void loop() {
    // read the input on analog pin 0:
    //│When this pin is A0 or the 31 ,the output is always 0. │
    //│When this pin is 0, the output can be right. │
    //│Excuse me, I need to modify which file, │
    //│where the pin is A0 can be correctly output,thanks. │
    int sensorValue = analogRead(A0);
    // print out the value you read:
    delay(100); // delay in between reads for stability

    1. Use
      int sensorValue = analogRead(0); //instead analogRead(A0)

      (I tested right now with an ATmega16 and my MINIAVR BOARD )

  4. Hello, Silvius,

    Thanks for the nice tutorial. I’ve used it to work with ATMega32APU.
    But, no matter what board I use (8MHz or 16MHz) in Arduino, the timing is off.
    When uploading the Blink sketch with Arduino as ISP, I get the same, quite slow blinking (maybe 7sec off, 7 on).
    Changing the Xtal from 8 to 16 does not help… I use this kind of breakout-board: . Basically it just brings out all the pins, has some capacitors around the Xtal.
    But how and where do I change the fusebits? Boards.txt, hardwareserial.cpp?
    Please help…

    1. 🙂 I also have this development board.

      Modifications in HardwareSerial.cpp are required for serial communications work… but there it is not about fusebits.

      Fusebits must be set anyway. You can set fusebits outside arduino ide with a program like:

      Khazama AVR Programmer:
      eXtreme Burner – AVR:

      to learn more about fusebits you can read here:

      in boards.txt fusebits are used only if you use Arduino IDE to burn bootloader otherwise are ignored
      … that is not the case for libraries on this site (so this is not necessary for our method)

    2. Hello Marc
      i also have the same problem you have the timing is off if you fix it
      please help…

  5. hello sir i m using atmega32 and your board, but issie i m facing is that some of port mapping are not working like PC2, PC3 are not working when i give code
    digitalWrite(18, HIGH); // turn the LED on (HIGH is the voltage level)
    delay(1000); // wait for a second
    digitalWrite(18, LOW); // turn the LED off by making the voltage LOW
    delay(1000); // wait for a second

    please help with the issie, and also delay of 1000 is taking more time

    1. Same issue here, JTAG is disabled. PC3 is working when replacing it with just 19.

  6. Hi Silvius.

    I followed the steps. Then uploaded the sketch using Arduino as ISP. I am not using an external oscillator, so I selected ATmega16-8MHz.

    On compiling, Arduino showed the following warning:

    :0:21: warning: missing whitespace after the macro name

    I uploaded anyway.
    The program is now running at around 1/8th of the speed. The one second blink set in the sketch is taking around 8 seconds.
    I am not able to figure out what I did wrong here.

    Please help.

    1. You can ignore this warning “missing whitespace after the macro name”.
      Anyway, I think is not from this library.

      Probably you use a new Atmega16 (or an Atmega with fusebits set to default)
      So you must set fusebints according with your usage…
      You can read this article to learn about fusebits…

  7. Hi,

    In case of arduino IDE 1.8.5, is the step No. 6 required ? I tried to edit HardwareSerial.cpp however didnt found the lines which you explained in step 6.

  8. Hi,

    I’ve noticed that “work is in progress for V1.01 which includes support for atmega1284P.
    Can I already use this (or a PRE-) version?
    I’m stuck with my 1284P and cannot get it to work.

  9. Hi Silvius,
    are you still working on Version 1.0.1. or is it available and if yes, how can I upgrade to that version?

Leave a Reply to weidoit Cancel reply

Your email address will not be published. Required fields are marked *

OpenHardware.Ro © 2017 Frontier Theme