On Thu, Jul 9, 2009 at 5:53 AM, Gary Carlson<gcarl...@carlson-minot.com> wrote:
> Zach/Spencer/Xiaofan,
>
> I did some more experimentation on the latest subversion (2499) and was able
> to tweak the jlink.c code slightly to possibly achieve three objectives:
>
> 1. Make jlink dongles work under Windows for Spencer.
> 2. Make jlink dongles work under Mac OS X for me.
> 3. Make jlink dongles work under Linux for Zach and Xiaofan.
> 4. Note the possible future problem that Xiaofan uncovered with libusb
> interactions in the Linux kernel and use it in such a way that the code in
> jlink.c won't cause future problems.
>
> I have confirmed #2 and believe that #4 is satisfied.  What I don't know is
> whether #1 and #4 are.  Could you try this out with your dongles and let me
> know what happens?
>
> If the patch works, I need to do a little cleanup but I didn't want to focus
> on that until I knew for sure whether it would solve the issues at hand.
>

I will test this patch this evening.

What I am thinking now is that this patch is still strange. Typically
the usb_set_configuration() will solve some problems for some USB
device (say USB toggle bit problems) since it is also a light weight
reset.

But in case usb_reset() is necessary, it is typically called during the
closing stage.

An example I wrote before.
http://www.microchip.com/forums/tm.aspx?m=340892

That is to say, typically you call these three instruction
when closing the usb_handle (after you finish the operation and
prepare for exit).

usb_release_interface(devh, 0);
usb_rese(devh); //adding this line makes the program happy
usb_close(devh);


Which means in this case:

static void jlink_usb_close(jlink_jtag_t *jlink_jtag)
{
        usb_close(jlink_jtag->usb_handle);
        free(jlink_jtag);
}

becomes

static void jlink_usb_close(jlink_jtag_t *jlink_jtag)
{
        usb_release_interface((jlink_jtag->usb_handle,0);
        usb_reset(jlink_jtag->usb_handle);
        usb_close(jlink_jtag->usb_handle);
        free(jlink_jtag);
}

Could you try this?

Personally I observed that normally first launch of OpenOCD is okay
and the subsequent launch of OpenOCD might cause startup problems.
So this indicates that the exit may not be so clean and this leads to
Jlink's initial status in a undesired state which even usb_set_configuration
can not help.

But if you see the problems even during the first launch, then the above
may not help.


-- 
Xiaofan http://mcuee.blogspot.com
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to