From c6d4b0113a76b53274af0f360906b6991f571c8c Mon Sep 17 00:00:00 2001 From: Kristian Wiklund Date: Sat, 7 Jan 2023 10:06:12 +0100 Subject: [PATCH 1/2] Support for building with platformio: Added symlink from src + a platformio config file --- platformio.ini | 19 +++++++++++++++++++ src | 1 + 2 files changed, 20 insertions(+) create mode 100644 platformio.ini create mode 120000 src diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000..f9bd756 --- /dev/null +++ b/platformio.ini @@ -0,0 +1,19 @@ +; 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 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 From 5f504f7d8704015471c4e2e33b816b8b2cd85dc5 Mon Sep 17 00:00:00 2001 From: Kristian Wiklund Date: Fri, 10 Feb 2023 18:18:49 +0100 Subject: [PATCH 2/2] made it platformio compatible --- .../DebugWireDebuggerProgrammer.ino | 26 ++++++++++++++++++- platformio.ini | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) 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 index f9bd756..2079aec 100644 --- a/platformio.ini +++ b/platformio.ini @@ -17,3 +17,4 @@ platform = atmelavr monitor_speed = 115200 monitor_echo = yes board = uno +build_options = -D DEVELOPER \ No newline at end of file