diff --git a/src/platforms/libftdi/platform.c b/src/platforms/libftdi/platform.c index 83683c7..3c52de9 100644 --- a/src/platforms/libftdi/platform.c +++ b/src/platforms/libftdi/platform.c @@ -83,6 +83,7 @@ cable_desc_t cable_desc[] = { .cbus_ddr = 0x02, .bitbang_tms_in_port_cmd = GET_BITS_LOW, .bitbang_tms_in_pin = MPSSE_TDO, /* keep bit 5 low*/ + .bitbang_swd_dbus_read_data = 0x02, .name = "ftdiswd" }, { diff --git a/src/platforms/libftdi/platform.h b/src/platforms/libftdi/platform.h index b3fae42..b669ad0 100644 --- a/src/platforms/libftdi/platform.h +++ b/src/platforms/libftdi/platform.h @@ -58,6 +58,9 @@ typedef struct cable_desc_s { uint8_t cbus_ddr; uint8_t bitbang_tms_in_port_cmd; uint8_t bitbang_tms_in_pin; + uint8_t bitbang_swd_dbus_read_data; + /* bitbang_swd_dbus_read_data is same as dbus_data, + * as long as CBUS is not involved.*/ char *description; char * name; }cable_desc_t; diff --git a/src/platforms/libftdi/swdptap.c b/src/platforms/libftdi/swdptap.c index 5d6279c..150083b 100644 --- a/src/platforms/libftdi/swdptap.c +++ b/src/platforms/libftdi/swdptap.c @@ -84,8 +84,12 @@ static void swdptap_turnaround(uint8_t dir) if(dir) { /* SWDIO goes to input */ cmd[index++] = SET_BITS_LOW; - cmd[index++] = active_cable->dbus_data | MPSSE_MASK; - cmd[index++] = active_cable->dbus_ddr & ~MPSSE_MASK; + if (active_cable->bitbang_swd_dbus_read_data) + cmd[index] = active_cable->bitbang_swd_dbus_read_data; + else + cmd[index] = active_cable->dbus_data; + index++; + cmd[index++] = active_cable->dbus_ddr & ~MPSSE_MASK; } /* One clock cycle */ cmd[index++] = MPSSE_TMS_SHIFT;