Standalone bootload burner for Atmega8/168/328 micro controllers without arduino board and computer

For a bootloader, that's true. I was also using the programmer to program a blink sketch into it for testing purposes, and that did require a crystal to run after programming.

At no time was any UNO injured.

:sunglasses:

:thinking:

![Standalone ATmega bootloader programmer|690x353]

I know that's what the Adafruit link says, but the atmega328_optiboot example was wired differently and i was following that.

Well Isn't that SPECIAL

What is going on with Adafruit documentation control ! ! !

:scream:


  • What happens on your LEDs while programming ?
  • What happens if you don't put a 328 in the ZIF and try to burn the bootloader ?

Chuckle. Always read the source, I say. I'm not entirely sure why the example uses the pin both as an input to start programming, then as an output to control the programmed ICs reset line. As this was just a "let's build it and see" project, I trusted that the author had a good reason for doing so and didn't dig into it.

The green LED comes on as soon as programming begins. The red LED only comes on if there's an error.

With no IC to be programmed, the green LED comes on to indicate that programming has begun, and the RED led comes on virtually simultaneously. That's what the example did and I left it as it was.

Assume the Piezo beeped ?

The piezo only beeps on successful programming.

  • Would you please confirm (with resistor values) this schematic reflects your wiring (excluding the crystal on the target) ?

I had higher resistor values on the LEDs but that's irrelevant. Other then the crystal and supporting caps, and a 0.1uF on Aref (all on the target), that looks like it matches what I put together.

For your documentation, added the crystal on the Target chip:

However it seems in the video they use a DIP package as a controller. I suspect it is an Arduino preprogramed to program the controller in the ZIF socket.

Hello, which sketch I need to upload in the left side controller to work as a bootload burner?

Can I burn bootloader into these chips? Atmega8/168/328??

It would be great if you provide steps.

See also Optiloader, which turns an Arduino into such a stand-alone programmer.
(The project you linked seems to be just a custom layout of an Arduino.) A cheap Nano will do fine.

There are of course many "alternative PCB layouts" for an Arduino. Here's one that has a ZIF could be turned into a programmer relatively trivially, by putting optiloader into a chip that would go on the SMT layout and connecting a few wires...

Both Adafruit and Nick Gammon have expanded on the optiloader idea, but they both also use a standard Arduino (or mega) as the "active" compute power.

Yes but which program I should burn in the master controller to make the same?

It would be great if you would actually read the information you have been previously provided with and see that your question has already been answered.

*Install the Library mentioned in the above schematic.

  • Use these changes in atmega328_optiboot.ino
#include "Adafruit_AVRProg.h"

Adafruit_AVRProg avrprog = Adafruit_AVRProg();

/*
 * Pins to target
 */
#define AVRPROG_SCK   13
#define AVRPROG_MISO  12
#define AVRPROG_MOSI  11
#define AVRPROG_RESET 10
//If we have clock out enabled, it will be on pin 9

#define BUTTON        17  //A3
#define PIEZOPIN      16  //A2
#define LED_ERR       15  //A1
#define LED_PROGMODE  14  //A0

extern const image_t *images[];

void setup() {
  Serial.begin(115200); /* Initialize serial for status msgs */

  while (!Serial)
    ;
  delay(100);

  Serial.println("\nAdaBootLoader Bootstrap programmer (originally OptiLoader "
                 "Bill Westfield (WestfW))");

  pinMode(PIEZOPIN, OUTPUT);
  pinMode(BUTTON, INPUT_PULLUP); // button for next programming

  avrprog.setProgramLED(LED_PROGMODE);
  avrprog.setErrorLED(LED_ERR);
  
  avrprog.generateClock();  // on pin 9

  avrprog.setSPI(AVRPROG_RESET, AVRPROG_SCK, AVRPROG_MOSI, AVRPROG_MISO);

}

void loop(void) {
  Serial.println("\nType 'G' or hit BUTTON for next chip");
  while (1) {
//    if (Serial.read() == 'G') {
//      break;
//    }
    if (!digitalRead(BUTTON)) {
      while (!digitalRead(BUTTON)) {
        delay(10);
      }          // wait for release
      delay(10); // debounce
      break;
    }
  }

  if (!avrprog.targetPower(true)) {
    avrprog.error("Failed to connect to target");
  }

  Serial.print(F("\nReading signature: "));
  uint16_t signature = avrprog.readSignature();
  Serial.println(signature, HEX);
  if (signature == 0 || signature == 0xFFFF) {
    avrprog.error(F("No target attached?"));
  }

  const image_t *targetimage = images[0];
  if (targetimage->image_chipsig != signature) {
    avrprog.error(F("Signature doesn't match image"));
  }
  Serial.println(F("Found matching chip/image"));

  Serial.print(F("Erasing chip..."));
  avrprog.eraseChip();
  Serial.println(F("Done!"));

  if (!avrprog.programFuses(
          targetimage->image_progfuses)) { // get fuses ready to program
    avrprog.error(F("Programming Fuses fail"));
  }

  if (!avrprog.verifyFuses(targetimage->image_progfuses,
                           targetimage->fusemask)) {
    avrprog.error(F("Failed to verify fuses"));
  }

  if (!avrprog.writeImage(targetimage->image_hexcode,
                          pgm_read_byte(&targetimage->image_pagesize),
                          pgm_read_word(&targetimage->chipsize))) {
    avrprog.error(F("Failed to write flash"));
  }

  Serial.println(F("\nVerifing flash..."));
  if (!avrprog.verifyImage(targetimage->image_hexcode)) {
    avrprog.error(F("Failed to verify flash"));
  }
  Serial.println(F("\nFlash verified correctly!"));

  // Set fuses to 'final' state
  if (!avrprog.programFuses(targetimage->image_normfuses)) {
    avrprog.error("Programming fuses fail");
  }

  if (!avrprog.verifyFuses(targetimage->image_normfuses,
                           targetimage->fusemask)) {
    avrprog.error("Failed to verify fuses");
  } else {
    Serial.println("Fuses verified correctly!");
  }

#if !defined(ESP32)
  // no 'tone' on ESP32
  tone(PIEZOPIN, 4000, 200);
#endif

  while (1)
    ;
}

This is what I am looking for at post#39. I know that Larry can provide proper information with details.

Thanks @LarryD Inwill try and let you know.

Great. Will try and let you know. BTW can we convert this schematic to PCB layout?

Who are we ? :thinking:

You can use one of the many PCB programs to design PCB boards.

EasyEDA, KiCAD and others.