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

 
 

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

patch #8435: Implementing mEDBG CMSIS-DAP protocol

Submitter:  Rainer Müller <raimue>
Submitted:  Sun 13 Apr 2014 11:05:04 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  joerg_wunsch Open/Closed:  Closed

Mon 15 Feb 2016 08:04:57 PM UTC, comment #4: 

Implemented in SVN r1369.

Unlike your suggestion, I made the name "xplainedmini" talk
ISP, and added "xplainedmini_dw" for debugWIRE mode (which
is certainly less frequently used).

Thanks for your USB traces, I could figure out how to
implement a usable fragmentation implementation.

Joerg Wunsch <joerg_wunsch>
Group administrator
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:

./avrdude -v -C avrdude.conf -c xplainedmini -p m168p -U flash:w:test1.hex


(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>
Group 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>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #31190:  xplained-mini-avrdude.pcapng added by raimue (4KiB - application/octet-stream)
file #31189:  xplained-mini-atmel-studio.pcapng added by raimue (59KiB - application/octet-stream)
file #31165:  lsusb-xplained-mini.txt added by raimue (5KiB - text/plain)
file #31166:  avr-xplained-mini-poc.patch added by raimue (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 11 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-15 joerg_wunsch StatusNone Done
        Assigned toNone joerg_wunsch
        Open/ClosedOpen Closed
    2014-04-17 raimue Attached File- Added xplained-mini-avrdude-without-zerolength.pcapng, #31192
        Attached File- Added xplained-mini-avrdude-without-zerolength.txt, #31193
    2014-04-17 raimue Attached File- Added xplained-mini-avrdude.pcapng, #31190
        Attached File- Added xplained-mini-avrdude.txt, #31191
    2014-04-17 raimue Attached File- Added xplained-mini-atmel-studio.pcapng, #31189
    2014-04-13 raimue Attached File- Added lsusb-xplained-mini.txt, #31165
        Attached File- Added avr-xplained-mini-poc.patch, #31166
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code