Some (all?) V6 firmware on the J-Link adapter fails to step the TAP unless
the first EMU_CMD_HW_JTAG3 command has 8 bits rather than 7, immediately
after adapter power-up. Add a hack to pad out to 8 bits, the first time
only.
Index: src/jtag/jlink.c
===================================================================
--- src/jtag/jlink.c (revision 1932)
+++ src/jtag/jlink.c (working copy)
@@ -692,6 +692,9 @@
static int pending_scan_results_length;
static pending_scan_result_t pending_scan_results_buffer[MAX_PENDING_SCAN_RESULTS];
+static int last_tms;
+static int first_time = 1;
+
static void jlink_tap_init(void)
{
tap_length = 0;
@@ -711,6 +714,7 @@
static void jlink_tap_append_step(int tms, int tdi)
{
+ last_tms = tms;
int index = tap_length / 8;
if (index >= JLINK_TAP_BUFFER_SIZE)
@@ -780,6 +784,19 @@
jlink_tap_append_step((tap_get_state() == TAP_RESET)?1:0, 0);
}
+ /* The first time we do a TAP move, pad last byte so that tap_length
+ * is divisible by 8. This is necessary for some V6 versions after a
+ * hard power-up. */
+ if (first_time) {
+ while (tap_length % 8 != 0)
+ {
+ /* More of the last TMS value keeps us in the same
+ * state, analogous to free-running JTAG interfaces. */
+ jlink_tap_append_step(last_tms, 0);
+ }
+ first_time = 0;
+ }
+
// number of full bytes (plus one if some would be left over)
byte_length = TAP_SCAN_BYTES(tap_length);
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development