diff --git a/DebugWireDebuggerProgrammer/DebugWireDebuggerProgrammer.ino b/DebugWireDebuggerProgrammer/DebugWireDebuggerProgrammer.ino index 3482776..cebd0b3 100644 --- a/DebugWireDebuggerProgrammer/DebugWireDebuggerProgrammer.ino +++ b/DebugWireDebuggerProgrammer/DebugWireDebuggerProgrammer.ino @@ -283,7 +283,7 @@ // 1 = 0 Brown-out Detector trigger level bit 1 // 0 = 1 Brown-out Detector trigger level bit 0 -#define DEVELOPER 0 +#define DEVELOPER 1 #define PMODE 8 // Input - HIGH = Program Mode, LOW = Debug Mode #define VCC 9 // Target Pin 8 - Vcc @@ -2041,6 +2041,30 @@ void debugger () { powerOff(); println(F("VCC off")); break; + + case 'G': // glitch the power to the chip + // give it 10 sec to allow window switching + getString(); + byte dd = readDecimal(1); + println(F("Glitching in 3s")); + for(int i=0;i<3;i++) { + delay(1000); + } + + Serial.println(dd); + + for(int i=0;i<1000;i++) { + digitalWrite(VCC, LOW); + delayMicroseconds(dd); + digitalWrite(VCC, HIGH); + pinMode(VCC, OUTPUT); + delayMicroseconds(dd); + if (!(i%100)) + Serial.println(":"); + } + println(F("VCC Restored")); + break; + #endif case 'B': // Cycle Vcc and Send BREAK to engage debugWire Mode diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..2079aec --- /dev/null +++ b/platformio.ini @@ -0,0 +1,20 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; https://docs.platformio.org/page/projectconf.html + +[platformio] +default_envs = uno + +[env:uno] +framework = arduino +platform = atmelavr +monitor_speed = 115200 +monitor_echo = yes +board = uno +build_options = -D DEVELOPER \ No newline at end of file diff --git a/src b/src new file mode 120000 index 0000000..941d469 --- /dev/null +++ b/src @@ -0,0 +1 @@ +DebugWireDebuggerProgrammer \ No newline at end of file