patchAVR Downloader/UploaDEr - Patches: patch #8435, Implementing mEDBG CMSIS-DAP...

 
 

You are not allowed to post comments on this tracker with your current authentification level.

patch #8435: Implementing mEDBG CMSIS-DAP protocol

Submitted by:  Rainer Müller <raimue>
Submitted on:  Sun 13 Apr 2014 11:05:04 PM UTC  
 
Category: NonePriority: 5 - Normal
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open

Thu 17 Apr 2014 12:21:13 PM UTC, comment #3:

I also attached xplained-mini-avrdude-without-zerolength.pcapng, which includes my proposed fix for this problem. The communication does not run into a timeout, but fails because of the unimplemented fragmentation for the EDBG protocol. The output from avrdude is again in xplained-mini-avrdude-without-zerolength.txt.

I hope this helps. Feel free to request further traces if need be.

(file #31192, file #31193)

Rainer Müller <raimue>
Thu 17 Apr 2014 12:20:30 PM UTC, comment #2:

I attached xplained-mini-atmel-studio.pcapng which contains an USB trace from wireshark. I obtained this on Linux while running Atmel Studio in a Windows VM. I programmed a minimal (empty main) file with the debugWire interface.

Additionally, to demonstrate the problem I was seeing, I attached xplained-mini-avrdude.pcapng. I obtained this on Linux using a patched avrdude. I only changed the packet size to 64 byte and the IDs of the endpoints, I left the usbdev_send() as it in the current trunk version. The output from avrdude is in xplained-mini-avrdude.txt. After the unexpected timeout, it eventually ran into the 10 second timeout.

The command used for avrdude was:

(file #31189, file #31190, file #31191)

Rainer Müller <raimue>
Mon 14 Apr 2014 06:03:28 AM UTC, comment #1:

Curious, could you please also attach a wireshark USB trace
for how Atmel Studio is handling the device? That way, one
could compare both. (I currently don't have an Xplained Mini
myself to cross-check.)

Joerg Wunsch <joerg_wunsch>
Project Administrator
Sun 13 Apr 2014 11:05:04 PM UTC, original submission:

The AVR Xplained Mini implements the mEDBG CMSIS-DAP protocol, which is similar to the EDBG protocol in the JTAGICE3, but not yet compatible with the current implementation. As far as I know, the board cannot not yet be ordered from Atmel as time of this writing, but I got one as a free giveaway at Embedded World this year.

I am attaching the listing from lsusb for the board, which has the vendor/product ID 03eb:2145. The most important difference in this mEDBG protocol compared to the EDBG in JTAGICE3 seems to be the packet size. While the JTAGICE3 uses 512-byte, this device only supports 64-byte packets.

As a proof of concept only, I modified avrdude until I got the board working up to the point to read the target device signature successfully. Programming does not work yet, as I ran into packet fragmentation which is not yet implemented for EDBG. I am attaching a patch with these proof-of-concept changes. I guess the constant USBDEV_MAX_XFER_3 needs to be programmer-specific in the future...

The biggest problem was encountered with the usbdev_send() function. In its current form, it always appends a zero-length packet after each payload. However, I tracked it down that exactly this causes problems with the Xplained Mini. When I analyzed the USB communication in wireshark, the zero-length packet seems to trigger another reply from the programmer which is unexpected. So I modified the code not to do this anymore.

At least I tested that applying the change in usbdev_send() alone still works with a JTAGICE3 with firmware 3.18 and also an AVRISP mkII with firmware 1.17. Maybe anyone with more knowledge can comment how this should be handled.

Rainer Müller <raimue>

 

Attached Files
file #31190:  xplained-mini-avrdude.pcapng added by raimue (4kB - application/octet-stream)
file #31189:  xplained-mini-atmel-studio.pcapng added by raimue (59kB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by joerg_wunsch (Posted a comment)
  • -unavailable- added by raimue (Submitted the item)
  • -unavailable- added by raimue
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 8 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 17 Apr 2014 12:21:13 PM UTCraimueAttached File-=>Added xplained-mini-avrdude-without-zerolength.pcapng, #31192
      Attached File-=>Added xplained-mini-avrdude-without-zerolength.txt, #31193
    Thu 17 Apr 2014 12:20:30 PM UTCraimueAttached File-=>Added xplained-mini-avrdude.pcapng, #31190
      Attached File-=>Added xplained-mini-avrdude.txt, #31191
    Thu 17 Apr 2014 12:20:29 PM UTCraimueAttached File-=>Added xplained-mini-atmel-studio.pcapng, #31189
    Sun 13 Apr 2014 11:05:04 PM UTCraimueAttached File-=>Added lsusb-xplained-mini.txt, #31165
      Attached File-=>Added avr-xplained-mini-poc.patch, #31166
      Carbon-Copy-=>Added -unavailable-

    Back to the top


    Powered by Savane 3.1-cleanup