Comments (4)
The comment by @askn37
#1649 (comment)
In my opinion, the original JTAG2UPDI has the following limitations:
- The last operation performed before ending the session must not be a write or erase. That operation may be lost. Many users may not be aware of this, as this is typically a write-verify pair. Adding a delay after the session ends does not solve the problem. This also applies to Nano Every.
- Any process that manipulates the status LED after a series of sessions has completed conflicts with starting a new session. The built-in timer malfunctions and times out, making it impossible to continue. To avoid this, a 1-2 second delay is required after the previous session ends. This is not the case with Nano Every, but it has a similar timer clearing process, so adding a short delay is recommended.
from avrdude.
The initial work-around by @askn37 was to change the test script.
#1649 (comment)
diff --git a/tools/test-avrdude b/tools/test-avrdude
index 85059976..1ad5d23b 100755
--- a/tools/test-avrdude
+++ b/tools/test-avrdude
@@ -326,7 +326,7 @@ for (( p=0; p<$arraylength; p++ )); do
if [ -n "$EE_SIZE" ]; then
specify="fuse access: set eesave fusebit to delete EEPROM on chip erase"
- command=(${avrdude[@]} -T '"config eesave=ee*erased"')
+ command=(${avrdude[@]} -T '"config eesave=ee*erased; config eesave"')
execute "${command[@]}" > $outfile
sed -e/^config/d -e/"> "/d $outfile > ${outfile}-2
result [[ ! -s ${outfile}-2 '&&' ! -s $logfile ]]
from avrdude.
Later @askn37 provided a patch which fixes the issue.
#1649 (comment)
diff --git a/src/jtagmkII.c b/src/jtagmkII.c
index 0aecb7ce..7ad73c84 100644
--- a/src/jtagmkII.c
+++ b/src/jtagmkII.c
@@ -87,6 +87,9 @@ struct pdata
/* Major firmware version (needed for Xmega programming) */
unsigned int fwver;
+ /* Remember if the last execution was a memory write */
+ int taint_write;
+
#define FLAGS32_INIT_SMC 1 // Part will undergo chip erase
#define FLAGS32_WRITE 2 // At least one write operation specified
// Couple of flag bits for AVR32 programming
@@ -142,6 +145,7 @@ static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
unsigned int addr, unsigned int n_bytes);
static unsigned char jtagmkII_mtype(const PROGRAMMER *pgm, const AVRPART *p, unsigned long addr);
static unsigned int jtagmkII_memaddr(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned long addr);
+static int jtagmkII_updi_term_keep_alive(const PROGRAMMER *pgm, const AVRPART *p_unused);
// AVR32
#define ERROR_SAB 0xFFFFFFFF
@@ -850,6 +854,7 @@ static int jtagmkII_chip_erase(const PROGRAMMER *pgm, const AVRPART *p) {
if (!(p->prog_modes & (PM_PDI | PM_UPDI)))
pgm->initialize(pgm, p);
+ PDATA(pgm)->taint_write = 1;
return 0;
}
@@ -1105,6 +1110,13 @@ static int jtagmkII_program_disable(const PROGRAMMER *pgm) {
if (!PDATA(pgm)->prog_enabled)
return 0;
+ // Delay early termination to ensure memory rewrite operations.
+ if (PDATA(pgm)->taint_write) {
+ pmsg_notice2("jtagmkII_program_disable(): Delay after writing: ");
+ jtagmkII_updi_term_keep_alive(pgm, /* unused */ (AVRPART*)NULL);
+ jtagmkII_updi_term_keep_alive(pgm, /* unused */ (AVRPART*)NULL);
+ }
+
buf[0] = CMND_LEAVE_PROGMODE;
pmsg_notice2("jtagmkII_program_disable(): "
"Sending leave progmode command: ");
@@ -1128,6 +1140,7 @@ static int jtagmkII_program_disable(const PROGRAMMER *pgm) {
return -1;
}
+ PDATA(pgm)->taint_write = 0;
PDATA(pgm)->prog_enabled = 0;
(void)jtagmkII_reset(pgm, 0x01);
@@ -2012,6 +2025,7 @@ static int jtagmkII_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const A
free(cmd);
serial_recv_timeout = otimeout;
+ PDATA(pgm)->taint_write = 1;
return n_bytes;
}
@@ -2102,6 +2116,7 @@ static int jtagmkII_paged_load(const PROGRAMMER *pgm, const AVRPART *p, const AV
}
serial_recv_timeout = otimeout;
+ PDATA(pgm)->taint_write = 0;
return n_bytes;
}
@@ -2290,6 +2305,7 @@ retry:
*value = resp[1];
free(resp);
+ PDATA(pgm)->taint_write = 0;
return 0;
fail:
@@ -2400,6 +2416,7 @@ retry:
}
free(resp);
+ PDATA(pgm)->taint_write = 1;
return 0;
fail:
from avrdude.
@stefanrueger has adapted the patch to PR #1662 and I have tested to be good.
from avrdude.
Related Issues (20)
- DragonFly BSD support HOT 9
- New attiny404 unprogrammable (RSP_ILLEGAL_MCU_STATE) HOT 6
- Autotools build improvement HOT 7
- Autotools build improvement -- to reduce the warnings HOT 3
- Autotools build improvement -- to support NetBSD HOT 2
- Autotools build improvement -- to support OpenBSD HOT 1
- Documentation current avrdude limitations in pdf/html documentation HOT 2
- Further jtag2updi improvement HOT 2
- avrdude documentation improvement HOT 5
- github actions improvement HOT 8
- avrintel.h missing from installation HOT 30
- avrdude error: no usb support, please compile again with libusb installed
- Avrdude "simple syntax" HOT 8
- AVR109 auto reset functionality HOT 2
- Implement Damerau Levenshtein distance checking for parts and memories HOT 6
- error: use of undeclared identifier 'AVRDUDE_FULL_VERSION' HOT 15
- LinuxGPIO or SPI doesn't work on NVIDIA Orin Nx HOT 7
- Which programmer supports "-E reset"? HOT 16
- Regression: EEPROM issue with official STK500 V1 FW -- avrdude 7.1 is okay but not 7.2 and 7.3 HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avrdude.