Hi Alex,

Thank you for the report and your testing indeed. BTW, with libjaylink
we finally started to feature support for SWO capture.

> Any plans for an official 0.10.x version anytime soon?

Given how slow we usually are with things like that, I'd say it's safe
to assume new release won't happen in 2+ months time.

However, in my personal opinion it's about time we should start
preparing, so if anyone wants to see his or her code reviewed and
merged before the release, please start pinging everybody involved.


---

** [tickets:#118] jlink.c: Bug in jlink_usb_io()**

**Status:** new
**Milestone:** 0.9.0
**Created:** Thu Feb 04, 2016 10:33 AM UTC by Alex Gruener, CTO SEGGER
**Last Updated:** Thu Feb 04, 2016 10:33 AM UTC
**Owner:** nobody


Hi,

I am writing here as an official SEGGER J-Link employee.
There is a bug in jlink_usb_io() in jlink.c that comes up with J-Link models 
that incorporate USB Hi-Speed.
It does not occur with older USB Full-Speed models:

~~~~
static int jlink_usb_io(struct jlink *jlink, int out_length, int in_length)
{
    [...]
        /*
         * Section 4.2.4 IN-transaction:
         * read dummy 0-byte packet if transaction size is
         * multiple of 64 bytes but not max. size of 0x8000
         */
        if ((in_length % 64) == 0 && in_length != 0x8000) {
                char dummy_buffer;
                result = usb_bulk_read_ex(jlink->usb_handle, jlink_read_ep,
                        &dummy_buffer, 1, JLINK_USB_TIMEOUT);
                if (result != 0) {
                        LOG_ERROR("dummy byte read failed");
                        return ERROR_JTAG_DEVICE_ERROR;
                }
        }
        return ERROR_OK;
}
~~~~


A dummy byte request should only be done if:
in_length == multiple of MaxPacketSize and not a multiple of 2 KB
MaxPacketSize for Full-Speed: 64 bytes
MaxPacketSize for Hi-Speed: 512 bytes

Correct pseudo-code:

~~~~
MaxPacketSize = _GetEPMaxPacketSize(iEP);
if ((in_length % MaxPacketSize) == 0) {
  if ((in_length % 0x800) != 0) {  // Needed for compatibility with J-Link 
Windows driver behavior
    _ReadDummyByte();
  }
}
~~~~

In case if additional information is needed etc., please to do not hesitate to 
contact me or SEGGER directly.


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to http://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
http://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to