Skip to content

Commit

Permalink
V2.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
felias-fogg committed Sep 8, 2024
1 parent ce7ff3b commit 5ffb046
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This sketch can resurrect many classic AVR chips with wrong fuse settings using

Sometimes, you may erroneously set a fuse bit, such as the clock source bit, and then the chip does not respond to ISP programming anymore. In this case, HV programming can help. One can easily reset all fuses to their factory setting, and then ISP programming is possible again. Note that the sketch does not implement a general HV programmer but can only perform some basic tasks, such as fuse setting and erasing the entire chip. Furthermore, you should not apply this technique "in-system" without pre-cautions. HV programming means that you apply 12 V to the RESET pin. So, if you do that "in-system," you should make sure that the RESET line is not connected to the rest of the system (e.g., by a pull-up resistor).

To do HV programming, you need an Arduino Uno, Nano, or Pro Mini, a breadboard, a PNP/NPN transistor pair, a few resistors, many jumper wires, and an external regulated 12-volt supply. If you are the happy owner of a *RecueAVR shield* for an Arduino Uno, everything is already included and set up, including the 12 V source. You can build such a shield using the KiCAD design files in the [PCB directory](pcb/) or buy the [PCBs or a kit at Tindie](https://www.tindie.com/products/35748/). The [assembly process](pcb/assembly.md) is straightforward and involves only THT components.
To do HV programming, you need an Arduino Uno, Nano, Pro Mini, or Mega(2560), a breadboard, a PNP/NPN transistor pair, a few resistors, many jumper wires, and an external regulated 12-volt supply. If you are the happy owner of a *RecueAVR shield* for an Arduino Uno/Mega, everything is already included and set up, including the 12 V source. You can build such a shield using the KiCAD design files in the [PCB directory](pcb/) or buy the [PCBs or a kit at Tindie](https://www.tindie.com/products/35748/). The [assembly process](pcb/assembly.md) is straightforward and involves only THT components.

Furthermore, the sketch is also an alternative firmware for [manekinen's Fusebit Doctor](https://web.archive.org/web/20180225102717/http://mdiy.pl/atmega-fusebit-doctor-hvpp/?lang=en). The pin mapping is different between these two versions. When the sketch is compiled for an Arduino Uno, Nano, or Pro Mini in the Arduino IDE, it will use the Arduino Uno pin mapping. Otherwise, it uses the pin mapping for the Fusebit Doctor. One can also force which version is produced by defining the compile-time constants `ARDUINO_MODE` or `FBD_MODE`, respectively.
Furthermore, the sketch is also an alternative firmware for [manekinen's Fusebit Doctor](https://web.archive.org/web/20180225102717/http://mdiy.pl/atmega-fusebit-doctor-hvpp/?lang=en). The pin mapping is different between these two versions. When the sketch is compiled for an Arduino Uno, Nano, Pro (Mini), or Mega(2560) in the Arduino IDE, it will use the Arduino Uno pin mapping. Otherwise, it uses the pin mapping for the Fusebit Doctor. One can also force which version is produced by defining the compile-time constants `ARDUINO_MODE` or `FBD_MODE`, respectively.

When using the sketch, remember to set the monitor baud rate to 19200 baud (no parity, 1 stop-bit). A [user manual](docs/manual.md) for the sketch is provided in the docs folder.

Expand Down
29 changes: 22 additions & 7 deletions RescueAVR.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// Title: RescueAVR

#define VERSION "2.6.0"
#define VERSION "2.7.0"

/*Copyright 2013-2021 by Bernhard Nebel and parts are copyrighted by Jeff Keyzer.
License: GPLv3
Expand All @@ -11,10 +11,9 @@
new, using ideas und snippets from Jeff Keyzer's sketch HVRescue_Shield.
In addition, the program can also be run on an Arduino Uno, Nano, or Pro.
The program can be either compiled for Arduino Uno, Nano, or Pro usage (when
ARDUINO_AVR_UNO ARDUINO_AVR_NANO is defined), or for Fusebit Doctor
boards (in all other cases). If you want to compile it for the
Fusebit Doctor board, I recommend to use the MiniCore.
The program can be either compiled for Arduino Uno, Nano, or Pro, Mega, or Leonardo,
or for Fusebit Doctor boards (in all other cases). If you want to compile it for the
Fusebit Doctor board, I recommend to use the MiniCore.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -67,6 +66,9 @@ Version 2.5.0 (28.8.2024)
Version 2.6.0
- fixed: handling of MCUs that read fuse and lock bits in one byte (AT90S2323 etc.)
- fixed: ATtiny11 & 12 handling
Version 2.7.0
- added Arduino Mega as a possible host platform
*/


Expand All @@ -77,15 +79,20 @@ Version 2.6.0
*/
// #define FBD_MODE
// #define ARDUINO_MODE
#ifdef ARDUINO_AVR_LEONARDO
#error "Arduino Leonardo is not supported"
#endif

#if !defined(FBD_MODE) && !defined(ARDUINO_MODE)
#if !defined(ARDUINO_AVR_UNO) && !defined(ARDUINO_AVR_NANO) && !defined(ARDUINO_AVR_PRO)
#if !defined(ARDUINO_AVR_UNO) && !defined(ARDUINO_AVR_NANO) && !defined(ARDUINO_AVR_PRO) && \
!defined(ARDUINO_AVR_MEGA) && !defined(ARDUINO_AVR_MEGA2560)
#define FBD_MODE
#else
#define ARDUINO_MODE
#endif
#endif


#include <avr/pgmspace.h>
#include <avr/wdt.h>

Expand Down Expand Up @@ -537,6 +544,11 @@ void setup() { // run once, when the sketch starts
char modec = ' ';

// Set up control lines for HV parallel programming

if (!Serial) {
while (!Serial);
delay(500);
}

setData(0);
setDataDirection(INPUT);
Expand Down Expand Up @@ -734,7 +746,10 @@ void loop() { // run over and over again

enterHVProgMode(mcu_mode);
switch (action) {
case 'R': wdt_enable(WDTO_15MS); delay(100); break;
case 'R':
wdt_enable(WDTO_15MS);
while (1);
break;
case 'T':
if (mcu_index >= 0) resurrection(dlfuse, dhfuse, defuse);
break;
Expand Down

0 comments on commit 5ffb046

Please sign in to comment.