avrdude-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avrdude-dev] [bug #50261] JTAG1 unable to write fuse and lock bits


From: anonymous
Subject: [avrdude-dev] [bug #50261] JTAG1 unable to write fuse and lock bits
Date: Thu, 9 Feb 2017 04:40:52 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0

URL:
  <http://savannah.nongnu.org/bugs/?50261>

                 Summary: JTAG1 unable to write fuse and lock bits
                 Project: AVR Downloader/UploaDEr
            Submitted by: None
            Submitted on: Thu 09 Feb 2017 09:40:51 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
         Originator Name: Stefan Mavrodiev
        Originator Email: address@hidden
             Open/Closed: Open
                 Release: SVN snapshot
         Discussion Lock: Any
     Programmer hardware: 
             Device type: 

    _______________________________________________________

Details:

Hello,

I'm using AVR-JTAG-USB from Olimex, witch is clone to AVR-JTAGICE.
I was unable to write fuses and lock bits. 

$ avrdude -c jtag1 -p c128 -P /dev/ttyUSB0 -b19200 -U lfuse:w:0xCF:m

avrdude: jtagmkI_initialize(): warning: OCDEN fuse not programmed, single-byte
EEPROM updates not possible
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e9781 (probably c128)
avrdude: reading input file "0xCF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xCF:
avrdude: load data lfuse data from input file 0xCF:
avrdude: input file 0xCF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading |                                                    | 0%
0.00savrdude: jtagmkI_read_byte(): timeout/error communicating with programmer
(resp )
avr_read(): error reading address 0x0000
    read operation not supported for memory "lfuse"
avrdude: failed to read all of lfuse memory, rc=-2

avrdude: jtagmkI_read_byte(): timeout/error communicating with programmer
(resp )
avrdude: jtagmkI_read_byte(): timeout/error communicating with programmer
(resp )
avrdude: jtagmkI_read_byte(): timeout/error communicating with programmer
(resp )
avrdude: jtagmkI_read_byte(): timeout/error communicating with programmer
(resp )
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up
and exited programming mode

avrdude done.  Thank you.

This is the same with lock and calibration bits.

I've notice that after write the response message has one additional ACK
byte.

avrdude: jtagmkI_send(): sending 6 bytes
avrdude: Send: W [57] . [b2] . [00] . [00] . [00] . [00]   [20]   [20] 
avrdude: Recv: A [41] 

avrdude: jtagmkI_send(): sending 2 bytes
avrdude: Send: h [68] . [cf]   [20]   [20] 
avrdude: Recv: A [41] 

Here you can see write is ok, but on following read:
avrdude: jtagmkI_send(): sending 6 bytes
avrdude: Send: R [52] . [b2] . [02] . [00] . [00] . [00]   [20]   [20] 
avrdude: Recv: A [41] A [41] . [cf] . [99] . [fe] . [00] 

You can see the extra 'A'. Maybe this is AVR-JTAGICE bug.

What I did in the patch is after sending datacmd read 2 bytes, not 1.

Index: jtagmkI.c
===================================================================
--- jtagmkI.c   (revision 1392)
+++ jtagmkI.c   (working copy)
@@ -1056,7 +1056,7 @@
 {
   unsigned char cmd[6], datacmd[1 * 2 + 1];
   unsigned char resp[1], writedata;
-  int len, need_progmode = 1;
+  int len, need_progmode = 1, need_dummy_read = 0;
 
   avrdude_message(MSG_NOTICE2, "%s: jtagmkI_write_byte(.., %s, 0x%lx,
...)\n",
            progname, mem->desc, addr);
@@ -1073,17 +1073,22 @@
     PDATA(pgm)->eeprom_pageaddr = (unsigned long)-1L;
   } else if (strcmp(mem->desc, "lfuse") == 0) {
     cmd[1] = MTYPE_FUSE_BITS;
+    need_dummy_read = 1;
     addr = 0;
   } else if (strcmp(mem->desc, "hfuse") == 0) {
     cmd[1] = MTYPE_FUSE_BITS;
+    need_dummy_read = 1;
     addr = 1;
   } else if (strcmp(mem->desc, "efuse") == 0) {
     cmd[1] = MTYPE_FUSE_BITS;
+    need_dummy_read = 1;
     addr = 2;
   } else if (strcmp(mem->desc, "lock") == 0) {
     cmd[1] = MTYPE_LOCK_BITS;
+    need_dummy_read = 1;
   } else if (strcmp(mem->desc, "calibration") == 0) {
     cmd[1] = MTYPE_OSCCAL_BYTE;
+    need_dummy_read = 1;
   } else if (strcmp(mem->desc, "signature") == 0) {
     cmd[1] = MTYPE_SIGN_JTAG;
   }
@@ -1152,6 +1157,8 @@
       avrdude_message(MSG_NOTICE2, "OK\n");
   }
 
+  if(need_dummy_read)
+    jtagmkI_recv(pgm, resp, 1);
   return 0;
 }





    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 09 Feb 2017 09:40:51 AM UTC  Name: jtagmkI.patch  Size: 1kB   By:
None

<http://savannah.nongnu.org/bugs/download.php?file_id=39707>

    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?50261>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]