From 625027a807f97eedf6339e033a7b10cadb56f415 Mon Sep 17 00:00:00 2001 From: MCUdude Date: Sat, 5 Feb 2022 14:44:13 +0100 Subject: [PATCH] Add HV UPDI pulse command --- src/jtag3.c | 4 ++++ src/jtag3_private.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/src/jtag3.c b/src/jtag3.c index 1681a001..b0815986 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1247,6 +1247,10 @@ static int jtag3_initialize(PROGRAMMER * pgm, AVRPART * p) } } + parm[0] = PARM3_UPDI_HV_SIMPLE_PULSE; + if (jtag3_setparm(pgm, SCOPE_AVR, 3, PARM3_OPT_12V_UPDI_ENABLE, parm, 1) < 0) + return -1; + u16_to_b2(xd.default_min_div1_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV1_VOLTAGE_MV); u16_to_b2(xd.default_min_div2_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV2_VOLTAGE_MV); u16_to_b2(xd.default_min_div4_voltage, DEFAULT_MINIMUM_CHARACTERISED_DIV4_VOLTAGE_MV); diff --git a/src/jtag3_private.h b/src/jtag3_private.h index a3e7fb08..3eeb61b3 100644 --- a/src/jtag3_private.h +++ b/src/jtag3_private.h @@ -236,6 +236,14 @@ #define PARM3_OPT_12V_UPDI_ENABLE 0x06 #define PARM3_OPT_CHIP_ERASE_TO_ENTER 0x07 +/* + * UPDI high-voltage enable modes + */ +#define PARM3_UPDI_HV_NONE 0x00 /* Do not use high-voltage */ +#define PARM3_UPDI_HV_SIMPLE_PULSE 0x01 /* Issue a single high-voltage pulse immediately*/ +#define PARM3_UPDI_HV_AUTO_POWER_TOGGLE 0x02 /* Toggle power automatically and then apply a high-voltage pulse */ +#define PARM3_UPDI_HV_USER_POWER_TOGGLE 0x03 /* The user toggles power, and the tool applies a high-voltage pulse on power-up */ + /* Xmega erase memory types, for CMND_XMEGA_ERASE */ #define XMEGA_ERASE_CHIP 0x00 #define XMEGA_ERASE_APP 0x01