From: Greg Davill Date: Sat, 31 Oct 2020 12:19:19 +0000 (+1030) Subject: jtag: Sample data input on negative clock edge X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b4d5e0e9ee1a3c13c00877e5895be441bd2c618f;p=ecpprog.git jtag: Sample data input on negative clock edge Verification is off by 1bit when sampling on the rising edge. Sampling on the megative edge also seems like a better option in general. --- diff --git a/ecpprog/jtag_tap.c b/ecpprog/jtag_tap.c index 17f4bfd..f791bdc 100644 --- a/ecpprog/jtag_tap.c +++ b/ecpprog/jtag_tap.c @@ -146,7 +146,7 @@ extern struct ftdi_context mpsse_ftdic; static inline void jtag_pulse_clock_and_read_tdo(bool tms, bool tdi) { - *ptr++ = MC_DATA_TMS | MC_DATA_IN | MC_DATA_LSB | MC_DATA_BITS | MC_DATA_OCN; + *ptr++ = MC_DATA_TMS | MC_DATA_IN | MC_DATA_LSB | MC_DATA_BITS | MC_DATA_OCN | MC_DATA_ICN; *ptr++ = 0; *ptr++ = (tdi ? 0x80 : 0) | (tms ? 0x01 : 0); rx_cnt++; @@ -200,7 +200,7 @@ static void jtag_shift_bytes( } //printf("jtag_shift_bytes(0x%08x,0x%08x,%u,%s);\n",input_data, output_data, data_bits, must_end ? "true" : "false"); uint32_t byte_count = data_bits / 8; - data[0] = MC_DATA_OUT | MC_DATA_IN | MC_DATA_LSB | MC_DATA_OCN; + data[0] = MC_DATA_OUT | MC_DATA_IN | MC_DATA_LSB | MC_DATA_OCN | MC_DATA_ICN; data[1] = (byte_count - 1); data[2] = (byte_count - 1) >> 8; memcpy(data + 3, input_data, byte_count); @@ -270,7 +270,7 @@ void jtag_go_to_state(unsigned state) } uint8_t data[3] = { - MC_DATA_TMS | MC_DATA_LSB | MC_DATA_BITS, + MC_DATA_TMS | MC_DATA_LSB | MC_DATA_BITS | MC_DATA_ICN, 5 - 1, 0b11111 };