Hi,

>> I can see one change that the referred commit introduced
>> to the ARM-JTAG-EW driver. It is that a speed setting in
>> the init script now actually is executed. Any such setting
>> was previously silently ignored.
> 
> Do you mean the following in jtag/core.c?
> 
> +       retval = jtag->speed(jtag_speed_var);
> +       if (retval != ERROR_OK)
> +               return retval;
> 
>>
>> The log shows that it is the speed setting that result in
>> the crash.

I did some further investigations and noticed the following:

When setting the speed in armjtagew_speed(), the length of
the outgoing message is obviously 5 not 4 (command + 4 bytes
of length information). Getting this right, fixes the error
when establishing the JTAG connection.

However, when I try to upload an image (size ~50kb), the upload fails
with the following error (full log as attachment to the ticket).

Debug: 46257 35631 arm-jtag-ew.c:815 armjtagew_usb_read():
armjtagew_usb_read, result = -116
Error: 46258 35631 arm-jtag-ew.c:775 armjtagew_usb_message():
usb_bulk_read failed (requested=1631, result=-116)
Error: 46259 35631 arm-jtag-ew.c:717 armjtagew_tap_execute():
armjtagew_tap_execute, wrong result -1, expected 1627

However, when the CMD_SET_TCK_FREQUENCY command is not executed, *and*
the subsequent CMD_GET_TCK_FREQUENCY, everything works fine (see patch).

The reported JTAG speed is 5867kHz most of the time, sometimes also
weird speeds are reported (including negativ ones), so there seems to be
a problem with this command, too.

The actual speed seems to be slower since flashing the 50kb takes about 80s.

The tests where performed using an Olimex ARM-JTAG-EW, firmware version
1.0.6.0, Olimex drivers (=libusb-win32-1.2.2.0), HEAD version of OpenOCD
built against libusb-win32-1.2.2.0 on Windows 7/x64.

My suggestion is to commit the attached workaround for the 0.5.0 release
in order to unbreak the ARM-JTAG-EW, and to investigate on the source of
the problems in a second step.

Best regards,
 Simon

diff --git a/src/jtag/drivers/arm-jtag-ew.c b/src/jtag/drivers/arm-jtag-ew.c
index 44eaeff..9f6717a 100644
--- a/src/jtag/drivers/arm-jtag-ew.c
+++ b/src/jtag/drivers/arm-jtag-ew.c
@@ -182,17 +182,27 @@ static int armjtagew_speed(int speed)
     int result;
     int speed_real;
 
-
+       /* TODO: Setting the jtag speed leads to subsequent usb_bulk_read
+        *       errors. See ticket #34.
+        *
+        *       For now, make this a NOP in order to fix the arm-jtag-ew.
+        *
+        *       Note, that while the read-out of the current speed leads to
+        *       unreliable results, it seems to be necessary for a working
+        *       initialization of the device.
+        */
+#if 0
     usb_out_buffer[0] = CMD_SET_TCK_FREQUENCY;
        buf_set_u32(usb_out_buffer + 1, 0, 32, speed);
 
-    result = armjtagew_usb_message(armjtagew_handle, 4, 4);
+    result = armjtagew_usb_message(armjtagew_handle, 5, 4);
 
     if (result < 0)
     {
         LOG_ERROR("ARM-JTAG-EW setting speed failed (%d)", result);
         return ERROR_JTAG_DEVICE_ERROR;
     }
+#endif
 
        usb_out_buffer[0] = CMD_GET_TCK_FREQUENCY;
     result = armjtagew_usb_message(armjtagew_handle, 1, 4);
@@ -204,7 +214,8 @@ static int armjtagew_speed(int speed)
        }
        else
        {
-       LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", speed, 
speed_real);
+       //      LOG_INFO("Requested speed %dkHz, emulator reported %dkHz.", 
speed, speed_real);
+               LOG_INFO("Setting the speed currently disabled for arm-jtag-ew. 
Current speed: %dkHz.", speed_real);
        }
 
     return ERROR_OK;

_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to