Go Down

Topic: OptiloaderBoard (Read 683 times) previous topic - next topic

garnienicht

Jan 07, 2013, 10:22 pm Last Edit: Jan 07, 2013, 10:32 pm by garnienicht Reason: 1
it just happened that i have blown up some ATMega328s on a Breadboard due to too high Voltage on the Input. Shame on me!
Looking over the mess, i recognized that one of the ATMega was still sort of working, but i have  destroyed digitalPin 0 (RX)...

Well, i have needed some new 328 with Bootloader, so i decided to build a Board around the "non-RX-Pin-328", dedicated to "burn" the Optiloader Bootloader to factory-new ATMega328s. Not that i would need it every day (hopefully  ;)), but just for fun. It is based on the OptiLoader sketch which can be found here: https://github.com/WestfW/OptiLoader

the PCB has the dimensoins of an Arduino-PCB, but ist neither a Arduino-Clone nor a Shield.
It supports 5V Power Supply via USB-B or a USB2SERIAL compatible FTDI-Style 6pin header, which also allows Serial communication for monitoring.
If you solder in C1, the autoReset functionality for the 6pin header is enabled, which would even allow to upload a sketch to the Master ATMega via USB2SERIAL.
To support feedback during the progress without Serial Communication, i have added a Power-ON statusLED for the Master ant the Target, a ERROR-LED and one for each function called in the loop() of the OptiLoadersketch.
I have soldered a basic 28pin socket for the Target ATMega on my PCB, but there shoud be enough space to use a 28pin ZIF Socket ;).

If anyone is interested, i have attached the Eagle files. Feel free to use it, reproduce it or modify it, but it would be great if you leave some feedback ;)

The Optiloader sketch needs to be a little bit modified inside the setup() and loop() in order to control the LEDs to something like the following:
Code: [Select]
void setup () {
 Serial.begin(19200); /* Initialize serial for status msgs */
 pinMode(13, OUTPUT); /* Blink the pin13 LED a few times */
 pulse(13,20);
 pinMode(A0, OUTPUT);
 pinMode(A1, OUTPUT);
 pinMode(A2, OUTPUT);
 pinMode(A3, OUTPUT);
 pinMode(A4, OUTPUT);
 pinMode(A5, OUTPUT);
}

void loop (void) {
 boolean error = false;
 fp("\nOptiLoader Bootstrap programmer.\n2011 by Bill Westfield (WestfW)\n\n");
 if (target_poweron()) { /* Turn on target power */
   do {
    if (!target_identify()){ /* Figure out what kind of CPU */
      error = true;
      break;
    } else digitalWrite(A5, HIGH);
    if (!target_findimage()){ /* look for an image */
      error = true;
      break;
    } else digitalWrite(A4, HIGH);
    if (!target_progfuses()){ /* get fuses ready to program */
      error = true;
      break;
    } else digitalWrite(A3, HIGH);
    if (!target_program()){ /* Program the image */
      error = true;
      break;
    } else digitalWrite(A2, HIGH);
     (void) target_normfuses(); /* reset fuses to normal mode */
     digitalWrite(A1, HIGH);
  }
  while (0);
 }
 else {
  error = true;
  Serial.println();
 }
target_poweroff(); /* turn power off */

 digitalWrite(A0, error);
 
 fp ("\nType 'G' or hit RESET for next chip\n")
   while (1) {
     if (Serial.read() == 'G'){
       digitalWrite(A5, LOW);
       digitalWrite(A4, LOW);
       digitalWrite(A3, LOW);
       digitalWrite(A2, LOW);
       digitalWrite(A1, LOW);
       digitalWrite(A0, LOW);
       break;
     }
   }
}


i know, the Hardware could be optimized. A polyfuse to protect the USB port would be nice. I think it would be not that bad to power the target 328 throug a transistor istead of the Master digital Pin 9, and the next time i would etch the PCB with bigger Pads for the Resistors , LEDs and Capacitors...  :smiley-roll-blue:
but after all... it is working!  8)

Go Up