From 202b6cab399a671a1231591c051fe372e76391d2 Mon Sep 17 00:00:00 2001
From: Joerg Wunsch <j@uriah.heep.sax.de>
Date: Mon, 6 Dec 2021 21:13:00 +0000
Subject: [PATCH] bug #58994: VPP PWM still enabled at the end of programming
 process Submitted by Dmitrii Chernukhin: * pickit2.c (pickit2_disable): turn
 off VPP before shutting down

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1508 81a1dc3b-b13d-400b-aceb-764788c761c2
---
 ChangeLog | 6 ++++++
 NEWS      | 1 +
 pickit2.c | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 40400e37..ca2da902 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2021-12-06  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
+
+	Submitted by Dmitrii Chernukhin:
+	bug #58994: VPP PWM still enabled at the end of programming process
+	* pickit2.c (pickit2_disable): turn off VPP before shutting down
+
 2021-12-05  Joerg Wunsch <j.gnu@uriah.heep.sax.de>
 
 	* configure.ac (AC_INIT): Bump version date
diff --git a/NEWS b/NEWS
index 8a147eb5..a5839493 100644
--- a/NEWS
+++ b/NEWS
@@ -81,6 +81,7 @@ Current:
     bug #46759: avrdude 6.1 -> 6.2 regression: lock byte verification error
     bug #58440: linuxgpio PIN limit too low
     bug #55462: wrong programmer id check in jtag3_getsync() and jtag3_close()
+    bug #58994: VPP PWM still enabled at the end of programming process
 
   * Patches:
     patch #9482: Add support for UPDI and AVR8X
diff --git a/pickit2.c b/pickit2.c
index af867097..5a0a5f6c 100644
--- a/pickit2.c
+++ b/pickit2.c
@@ -330,6 +330,8 @@ static void pickit2_disable(PROGRAMMER * pgm)
         SCR_MCLR_GND_OFF,
         SCR_VPP_OFF,
         SCR_VDD_OFF,
+        SCR_VPP_PWM_OFF,
+        SCR_DELAY_2(.01),
         SCR_BUSY_LED_OFF,
         CMD_END_OF_BUFFER
     };