WRITE FAILED ON ATXMEGA192A3U WITH AVRDUDE (ATMEL ICE PROGRAMMER IN PDI MODE)

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone !

I'm having a very frustrating problem with avrdude 6.1...

I'm trying to program my ATXmega192a3u chip with a ATMEL ICE CMSIS/DAP in PDI mode, but for some reason I am unable to write in the flash memory (or boot, application, apptable) when using avrdude.

What I have managed to already do :

  1. program my chip with Atmel Studio 6.2 on a Virtual Machine on the same computer (with the exact same setup).
  2. write in the EEPROM and fuses of the ATXmega192a3u in terminal mode (and also in command mode) with avrdude.
  3. read/verify from the ATXmega192a3u (previously programmed successfully with Atmel Studio 6.2) into a .hex file (writing in a .elf file is not supported).
  4. program a ATXmega8E5 chip with avrdude (that is on the same board as the x192a3u chip) without any error.

But now I really want avrdude to work for my chip (in order to write a .sh script to program several chips on my board at once in an automatic way) ! 

 

The command I use is this one :

sudo avrdude -v -p x192a3u -c atmelice_pdi -e -u \
	-U fuse0:w:"/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf":e \
	-U fuse1:w:"/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf":e \
	-U fuse2:w:"/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf":e \
	-U fuse4:w:"/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf":e \
	-U fuse5:w:"/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf":e \
	-U boot:w:"/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf":e \
	-U application:w:"/home/mobirider/Projects/atmel-mobirider/Debug/atmel-mobirider.hex":i \

The error message is as follows :

avrdude: reading input file "/home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf"
avrdude: writing boot (8180 bytes):

Writing |                                                    | 0% 0.00s
avrdude: jtag3_edbg_send(): Fragmentation not (yet) implemented!
avrdude: jtag3_edbg_recv(): Unexpected response 0x81, 0x00
avrdude: write memory command: timeout/error communicating with programmer (status -1)
Writing | ################################################## | 100% 9.60s

avrdude: 8180 bytes of boot written
avrdude: verifying boot memory against /home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf:
avrdude: load data boot data from input file /home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf:
avrdude: input file /home/mobirider/Projects/atmel-bootloader/Debug/atmel-bootloader.elf contains 8180 bytes
avrdude: reading on-chip boot data:

Reading | ################################################## | 100% 0.09s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xff != 0xfd
avrdude: verification error; content mismatch

avrdude done.  Thank you.

I have tried also replacing "boot" and "application" by "flash" or "apptable" but the result is the same...

Writing a .elf file or a .hex file fails all the same...

In terminal mode I attempted to write some data byte per byte but the result was also a failure :

$sudo avrdude -v -p x192a3u -c atmelice_pdi -t

avrdude: Version 6.1, compiled on Nov 23 2014 at 21:15:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "/etc/avrdude.conf"
         User configuration file is "/home/mobirider/.avrduderc"
         User configuration file does not exist or is not a regular file, skipping

         Using Port                    : usb
         Using Programmer              : atmelice_pdi
avrdude: usbdev_open(): Found Atmel-ICE CMSIS-DAP, serno: J41800018102
avrdude: Found CMSIS-DAP compliant device, using EDBG protocol
         AVR Part                      : ATxmega192A3U
         Chip Erase delay              : 0 us
         PAGEL                         : P00
         BS2                           : P00
         RESET disposition             : dedicated
         RETRY pulse                   : SCK
         serial program mode           : yes
         parallel program mode         : yes
         Timeout                       : 0
         StabDelay                     : 0
         CmdexeDelay                   : 0
         SyncLoops                     : 0
         ByteDelay                     : 0
         PollIndex                     : 0
         PollValue                     : 0x00
         Memory Detail                 :

                                  Block Poll               Page                       Polled
           Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00
           prodsig        0     0     0    0 no         50   50      0     0     0 0x00 0x00
           fuse1          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse2          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse4          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           fuse5          0     0     0    0 no          1    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0     0     0 0x00 0x00
           data           0     0     0    0 no          0    0      0     0     0 0x00 0x00
           eeprom         0     0     0    0 no       2048   32      0     0     0 0x00 0x00
           application    0     0     0    0 no     196608  512      0     0     0 0x00 0x00
           apptable       0     0     0    0 no       8192  512      0     0     0 0x00 0x00
           boot           0     0     0    0 no       8192  512      0     0     0 0x00 0x00
           flash          0     0     0    0 no     204800  512      0     0     0 0x00 0x00
           usersig        0     0     0    0 no        512  512      0     0     0 0x00 0x00
           fuse0          0     0     0    0 no          1    0      0     0     0 0x00 0x00

         Programmer Type : JTAGICE3_PDI
         Description     : Atmel-ICE (ARM/AVR) in PDI mode
         ICE hardware version: 0
         ICE firmware version: 1.22 (rel. 65)
         Serial number   : J418000181028102��������������������������������������������������������������������������������������������������������������������
         Vtarget         : 3.27 V
         JTAG clock megaAVR/program: 1000 kHz
         JTAG clock megaAVR/debug:   1000 kHz
         JTAG clock Xmega: 1000 kHz
         PDI clock Xmega : 1000 kHz

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9744
avrdude> dump flash 0 16
>>> dump flash 0 16 
0000  0c 94 79 08 0c 94 f4 28  0c 94 1e 29 0c 94 48 29  | .y. ..( ..) .H)|

avrdude> write flash 0 1 2 3 4 5
>>> write flash 0 1 2 3 4 5 
avrdude (write): error writing 0x01 at 0x00000 cell=0x0c
avrdude (write): error writing 0x02 at 0x00001 cell=0x94
avrdude (write): error writing 0x03 at 0x00002 cell=0x79
avrdude (write): error writing 0x04 at 0x00003 cell=0x08
avrdude (write): error writing 0x05 at 0x00004 cell=0x0c

However I found that this might not work because it is currently not supported (as read from the 4th problem in http://www.nongnu.org/avrdude/us...)

 

I tried checking the syslog for some useful information, I came accross this when I execute my program for the first time after plugging the programmer via USB :

usb 2-1.3.4: new high-speed USB device number 65 using ehci-pci
usb 2-1.3.4: New USB device found, idVendor=03eb, idProduct=2141
usb 2-1.3.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 2-1.3.4: Product: Atmel-ICE CMSIS-DAP
usb 2-1.3.4: Manufacturer: Atmel Corp.
usb 2-1.3.4: SerialNumber: J41800018102
hid-generic 0003:03EB:2141.0071: hiddev0,hidraw1: USB HID v1.11 Device [Atmel Corp. Atmel-ICE CMSIS-DAP] on usb-0000:00:1d.0-1.3.4/input0

usb 2-1.3.4: usbfs: interface 0 claimed by usbhid while 'avrdude' sets config #1

I attached in a .txt file the avrdude operations I did with a little bit more information than written above : you will find inside the failed attempt to program the x192a3u, the successful attempt to program the x8e5 and the failed attempt to write in the flash memory in terminal mode.

 

Also, another info about the configuration I have (when running ./configure in the avrdude directory) :

Configuration summary:
----------------------
DO HAVE    libelf
DO HAVE    libusb
DO HAVE    libusb_1_0
DON'T HAVE libftdi1
DO HAVE    libftdi
DON'T HAVE libhid
DO HAVE    pthread
DISABLED   doc
ENABLED    parport
DISABLED   linuxgpio

 

Does anyone know where the problem could possibly come from ? I have not found any answers for this problem anywhere on forums...

The problem is most definitely a compatibility issue between the chip, the programmer, avrdude 6.1, but I have not found any solution for now (although I have been searching for days !).

Any information would be a really great help !

 

Thanks in advance.

 

John

 

 

 

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi any success with this issue ? got same problem with atxmega128a3u

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey !

I haven't been able to fix this issue unfortunately...

But ! I can tell you something that works :

1. take your ATMEL-ICE

2. put it away in a drawer somewhere, never to be seen again

3. buy a Olimex AVR-ISP-MK2 programmer

4. do the same thing you tried to do with the ATMEL-ICE

5. see that it works

6. be happy :)

 

Good luck !

 

John

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ehehehe we should have read more before buying our gear :)

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi.

 

Just in case someone else is struggling.

I got my Atmel-ICE working with avrdude by implementing fragmentation for jtag3.

 

Here's how to do it:

  1. Download source code, avrdude-6.1. (http://www.nongnu.org/avrdude/)
  2. Download patch file #31187 to fix the STDINT issue. (http://savannah.nongnu.org/patch...)
  3. Apply patch to source code. (patch < stdint-fix.patch)
  4. Implement fragmentation for jtag3
    1. Option A
      1. Download patch file #32778. (http://savannah.nongnu.org/patch...)
      2. Because it doesn't match the avrdude version we have to manually apply this patch. (Perhaps someone knows a smarter way)
    2. Option B
      1. Download attached patch file I made after manually applying the patch file #32778.
      2. Apply patch to source code. (patch < avrice_fragment_fix2.patch)
  5. ./configure
  6. make
  7. make install

 

Thanks to the guys who posted the patch files!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I had the exact same problem as the OP when trying to flash the bootloader code on my xmega256a3u. (usiung ubuntu 16.04 avrdude)

upgrading from avrdude 6.2 to 6.3 did the trick.

 

Hope someone else can now benefit from my days of searching.

 

this:

avrdude -p x256a3u -P usb -c atmelice -e -v -U boot:w:xboot-boot.hex -U fuse2:w:0xBF:m

 

now, FINALLY, works.