enhanced init sequence in *_mpsse_open()

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1101 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Arnim Läuger 17 years ago
parent cf5c40b075
commit aa43c22d92

@ -1,3 +1,9 @@
2008-02-26 Arnim Laeuger <arniml@users.sourceforge.net>
* src/tap/cable/ft2232.c (send_and_receive): loopback_off moved to ftdi.c/ftd2xx.c
* src/tap/parport/ftd2xx.c (ftd2xx_mpsse_open): set TCK, loopback_off, reset, purge
* src/tap/parport/ftdi.c (ftdi_mpsse_open): set TCK, loopback_off, reset, purge
2008-02-24 Mike Frysinger <vapier>
* src/jtag.c: allow people to disable startup message (1901877),

@ -341,10 +341,6 @@ ft2232_generic_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* safe default values */
params->low_byte_value = 0;
params->low_byte_dir = 0;
@ -379,10 +375,6 @@ ft2232_jtagkey_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* static low byte value and direction:
set nOE to '0' -> activate output enables */
params->low_byte_value = 0;
@ -428,10 +420,6 @@ ft2232_armusbocd_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* static low byte value and direction:
set nOE to '0' -> activate output enables */
params->low_byte_value = 0;
@ -481,10 +469,6 @@ ft2232_oocdlinks_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* static low byte value and direction */
params->low_byte_value = 0;
params->low_byte_dir = 0;
@ -530,10 +514,6 @@ ft2232_turtelizer2_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* static low byte value and direction:
set nJTAGOE to '0' -> activate output enables
set RST to 0 -> inactive nSRST */
@ -574,10 +554,6 @@ ft2232_usbtojtagif_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* static low byte value and direction:
nTRST = 1, RST = 1, DBGRQ = 0 */
params->low_byte_value = BITMASK_USBTOJTAGIF_nTRST | BITMASK_USBTOJTAGIF_RST;
@ -619,10 +595,6 @@ ft2232_signalyzer_init( cable_t *cable )
if (parport_open( p ))
return -1;
/* set loopback off */
push_to_send( params, LOOPBACK_END );
send_and_receive( cable, COMPLETELY );
/* static low byte value and direction:
nTRST = 1, RST = 1, DBGRQ = 0 */
params->low_byte_value = BITMASK_SIGNALYZER_nTRST | BITMASK_SIGNALYZER_nSRST;

@ -74,6 +74,8 @@ typedef struct {
int outbuf_len;
} ftd2xx_params_t;
static int ftd2xx_set_data ( parport_t *parport, uint8_t data );
static int ftd2xx_set_control ( parport_t *parport, uint8_t data );
static int ftd2xx_flush_output ( ftd2xx_params_t *p );
static parport_t *
@ -283,7 +285,7 @@ ftd2xx_mpsse_open( parport_t *parport )
Ref. FTCJTAGPG10.pdf
Intermittent problems will occur when certain steps are skipped. */
if ((status = FT_ResetDevice(fc)) != FT_OK) {
fprintf(stderr, "Can't reset 1 device: %li\n", status);
fprintf(stderr, "Can't reset device: %li\n", status);
FT_Close(fc);
return -1;
}
@ -311,7 +313,27 @@ ftd2xx_mpsse_open( parport_t *parport )
return -1;
}
if ((status = FT_ResetDevice(fc)) != FT_OK) {
fprintf(stderr, "Can't reset 2 device: %li\n", status);
fprintf(stderr, "Can't reset device: %li\n", status);
FT_Close(fc);
return -1;
}
if ((status = FT_Purge(fc, FT_PURGE_RX | FT_PURGE_TX)) != FT_OK) {
fprintf(stderr, "Can't purge buffers: %li\n", status);
FT_Close(fc);
return -1;
}
/* set TCK Divisor */
ftd2xx_set_data(parport, 0x86);
ftd2xx_set_data(parport, 0x00);
ftd2xx_set_data(parport, 0x00);
ftd2xx_set_control(parport, 1);
ftd2xx_set_control(parport, 0);
/* switch off loopback */
ftd2xx_set_data(parport, 0x85);
ftd2xx_set_control(parport, 1);
ftd2xx_set_control(parport, 0);
if ((status = FT_ResetDevice(fc)) != FT_OK) {
fprintf(stderr, "Can't reset device: %li\n", status);
FT_Close(fc);
return -1;
}

@ -69,6 +69,8 @@ typedef struct {
int outbuf_len;
} ftdi_params_t;
static int ftdi_set_data ( parport_t *parport, uint8_t data );
static int ftdi_set_control ( parport_t *parport, uint8_t data );
static int ftdi_flush_output ( ftdi_params_t *p );
static parport_t *
@ -367,7 +369,32 @@ ftdi_mpsse_open( parport_t *parport )
ftdi_deinit(fc);
return -1;
}
/* set TCK Divisor */
ftdi_set_data(parport, TCK_DIVISOR);
ftdi_set_data(parport, 0x00);
ftdi_set_data(parport, 0x00);
ftdi_set_control(parport, 1);
ftdi_set_control(parport, 0);
/* switch off loopback */
ftdi_set_data(parport, LOOPBACK_END);
ftdi_set_control(parport, 1);
ftdi_set_control(parport, 0);
if (ftdi_usb_reset(fc) < 0)
{
fprintf (stderr, "Can't reset USB: %s\n",
ftdi_get_error_string (fc));
ftdi_usb_close(fc);
ftdi_deinit(fc);
return -1;
}
if (ftdi_usb_purge_buffers(fc) < 0)
{
fprintf (stderr, "Can't purge USB buffers: %s\n",
ftdi_get_error_string (fc));
ftdi_usb_close(fc);
ftdi_deinit(fc);
return -1;
}
return 0;
}

Loading…
Cancel
Save