hosted/ftdi: Updated the 'cables' definitions

This commit is contained in:
dragonmux 2022-06-15 22:00:58 -04:00 committed by Piotr Esden-Tempski
parent 5ec848e948
commit fbe804f905
2 changed files with 96 additions and 91 deletions

View File

@ -41,7 +41,8 @@ data_desc_t active_state;
cable_desc_t cable_desc[] = { cable_desc_t cable_desc[] = {
{ {
/* Direct connection from FTDI to Jtag/Swd. /* Direct connection from FTDI to Jtag/Swd.
Pin 6 direct connected to RST.*/ * Pin 6 direct connected to RST.
*/
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6014, .product = 0x6014,
.interface = INTERFACE_A, .interface = INTERFACE_A,
@ -53,17 +54,18 @@ cable_desc_t cable_desc[] = {
}, },
{ {
/* Direct connection from FTDI to Jtag/Swd. /* Direct connection from FTDI to Jtag/Swd.
Pin 6 direct connected to RST.*/ * Pin 6 direct connected to RST.
*/
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6010, .product = 0x6010,
.interface = INTERFACE_A, .interface = INTERFACE_A,
.init.data_low = PIN6, /* PULL nRST high*/ .init.data_low = PIN6, /* PULL nRST high*/
.bb_swdio_in_port_cmd = GET_BITS_LOW, .bb_swdio_in_port_cmd = GET_BITS_LOW,
.bb_swdio_in_pin = MPSSE_CS, .bb_swdio_in_pin = MPSSE_CS,
.assert_srst.data_low = ~PIN6, .assert_nrst.data_low = ~PIN6,
.assert_srst.ddr_low = PIN6, .assert_nrst.ddr_low = PIN6,
.deassert_srst.data_low = PIN6, .deassert_nrst.data_low = PIN6,
.deassert_srst.ddr_low = ~PIN6, .deassert_nrst.ddr_low = ~PIN6,
.description = "FLOSS-JTAG", .description = "FLOSS-JTAG",
.name = "flossjtag" .name = "flossjtag"
}, },
@ -75,7 +77,8 @@ cable_desc_t cable_desc[] = {
* resistor is not necessary, but protects * resistor is not necessary, but protects
* from contentions in case of errors. * from contentions in case of errors.
* JTAG not possible * JTAG not possible
* PIN6 (DB6) ----------- NRST */ * PIN6 (DB6) ----------- NRST
*/
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6010,/*FT2232H*/ .product = 0x6010,/*FT2232H*/
.interface = INTERFACE_B, .interface = INTERFACE_B,
@ -83,10 +86,10 @@ cable_desc_t cable_desc[] = {
.init.ddr_low = PIN4, /* Pull up pin 4 */ .init.ddr_low = PIN4, /* Pull up pin 4 */
.mpsse_swd_read.set_data_low = MPSSE_DO, .mpsse_swd_read.set_data_low = MPSSE_DO,
.mpsse_swd_write.set_data_low = MPSSE_DO, .mpsse_swd_write.set_data_low = MPSSE_DO,
.assert_srst.data_low = ~PIN6, .assert_nrst.data_low = ~PIN6,
.assert_srst.ddr_low = PIN6, .assert_nrst.ddr_low = PIN6,
.deassert_srst.data_low = PIN6, .deassert_nrst.data_low = PIN6,
.deassert_srst.ddr_low = ~PIN6, .deassert_nrst.ddr_low = ~PIN6,
.target_voltage_cmd = GET_BITS_LOW, .target_voltage_cmd = GET_BITS_LOW,
.target_voltage_pin = PIN4, /* Always read as target voltage present.*/ .target_voltage_pin = PIN4, /* Always read as target voltage present.*/
.description = "USBMATE", .description = "USBMATE",
@ -99,7 +102,8 @@ cable_desc_t cable_desc[] = {
* DO is tristated with SWD read, so * DO is tristated with SWD read, so
* resistor is not necessary, but protects * resistor is not necessary, but protects
* from contentions in case of errors. * from contentions in case of errors.
* JTAG not possible.*/ * JTAG not possible.
*/
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6014,/*FT232H*/ .product = 0x6014,/*FT232H*/
.interface = INTERFACE_A, .interface = INTERFACE_A,
@ -113,9 +117,9 @@ cable_desc_t cable_desc[] = {
* SWD not possible. * SWD not possible.
* PIN4 low enables buffers * PIN4 low enables buffers
* PIN5 Low indicates VRef applied * PIN5 Low indicates VRef applied
* PIN6 reads back SRST * PIN6 reads back nRST
* CBUS PIN1 Sets SRST * CBUS PIN1 Sets nRST
* CBUS PIN2 low drives SRST * CBUS PIN2 low drives nRST
*/ */
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6010, .product = 0x6010,
@ -123,10 +127,10 @@ cable_desc_t cable_desc[] = {
.init.ddr_low = PIN4, .init.ddr_low = PIN4,
.init.data_high = PIN4 | PIN3 | PIN2, .init.data_high = PIN4 | PIN3 | PIN2,
.init.ddr_high = PIN4 | PIN3 | PIN2 | PIN1 | PIN0, .init.ddr_high = PIN4 | PIN3 | PIN2 | PIN1 | PIN0,
.assert_srst.data_high = ~PIN3, .assert_nrst.data_high = ~PIN3,
.deassert_srst.data_high = PIN3, .deassert_nrst.data_high = PIN3,
.srst_get_port_cmd = GET_BITS_LOW, .nrst_get_port_cmd = GET_BITS_LOW,
.srst_get_pin = PIN6, .nrst_get_pin = PIN6,
.description = "FTDIJTAG", .description = "FTDIJTAG",
.name = "ftdijtag" .name = "ftdijtag"
}, },
@ -135,7 +139,7 @@ cable_desc_t cable_desc[] = {
* JTAG and control on INTERFACE_B * JTAG and control on INTERFACE_B
* Bit 5 high selects SWD-WRITE (TMS routed to MPSSE_DI) * Bit 5 high selects SWD-WRITE (TMS routed to MPSSE_DI)
* Bit 6 high selects JTAG vs SWD (TMS routed to MPSSE_CS) * Bit 6 high selects JTAG vs SWD (TMS routed to MPSSE_CS)
* BCBUS 1 (Output) N_SRST * BCBUS 1 (Output) N_RST
* BCBUS 2 (Input/ Internal Pull Up) V_ISO available * BCBUS 2 (Input/ Internal Pull Up) V_ISO available
* *
* For bitbanged SWD, set Bit 5 low and select SWD read with * For bitbanged SWD, set Bit 5 low and select SWD read with
@ -151,10 +155,10 @@ cable_desc_t cable_desc[] = {
.init.data_low = PIN6 | PIN5, .init.data_low = PIN6 | PIN5,
.init.ddr_low = PIN6 | PIN5, .init.ddr_low = PIN6 | PIN5,
.init.data_high = PIN1 | PIN2, .init.data_high = PIN1 | PIN2,
.assert_srst.data_high = ~PIN1, .assert_nrst.data_high = ~PIN1,
.assert_srst.ddr_high = PIN1, .assert_nrst.ddr_high = PIN1,
.deassert_srst.data_high = PIN1, .deassert_nrst.data_high = PIN1,
.deassert_srst.ddr_high = ~PIN1, .deassert_nrst.ddr_high = ~PIN1,
.mpsse_swd_read.clr_data_low = PIN5 | PIN6, .mpsse_swd_read.clr_data_low = PIN5 | PIN6,
.mpsse_swd_write.set_data_low = PIN5, .mpsse_swd_write.set_data_low = PIN5,
.mpsse_swd_write.clr_data_low = PIN6, .mpsse_swd_write.clr_data_low = PIN6,
@ -177,8 +181,8 @@ cable_desc_t cable_desc[] = {
* => SWD not possible. * => SWD not possible.
* DBUS PIN4 / JTAGOE low enables buffers * DBUS PIN4 / JTAGOE low enables buffers
* DBUS PIN5 / TRST high drives nTRST low OC * DBUS PIN5 / TRST high drives nTRST low OC
* DBUS PIN6 / RST high drives nSRST low OC * DBUS PIN6 / RST high drives nRST low OC
* CBUS PIN0 reads back SRST * CBUS PIN0 reads back nRST
*/ */
.vendor = 0x0403, .vendor = 0x0403,
.product = 0xbdc8, .product = 0xbdc8,
@ -187,10 +191,10 @@ cable_desc_t cable_desc[] = {
.init.data_low = 0, .init.data_low = 0,
.init.ddr_low = PIN6 | PIN5 | PIN4, .init.ddr_low = PIN6 | PIN5 | PIN4,
.init.ddr_high = PIN2, /* ONE LED */ .init.ddr_high = PIN2, /* ONE LED */
.assert_srst.data_low = PIN6, .assert_nrst.data_low = PIN6,
.deassert_srst.data_low = ~PIN6, .deassert_nrst.data_low = ~PIN6,
.srst_get_port_cmd = GET_BITS_HIGH, .nrst_get_port_cmd = GET_BITS_HIGH,
.srst_get_pin = PIN0, .nrst_get_pin = PIN0,
.name = "turtelizer", .name = "turtelizer",
.description = "Turtelizer JTAG/RS232 Adapter" .description = "Turtelizer JTAG/RS232 Adapter"
}, },
@ -260,6 +264,7 @@ cable_desc_t cable_desc[] = {
.init.ddr_high = PIN4 | PIN3 | PIN1 | PIN0, .init.ddr_high = PIN4 | PIN3 | PIN1 | PIN0,
.name = "arm-usb-ocd-h" .name = "arm-usb-ocd-h"
}, },
{
/* ESP Prog: /* ESP Prog:
* *
* JTAG buffered on Interface A -> No SWD * JTAG buffered on Interface A -> No SWD
@ -269,7 +274,6 @@ cable_desc_t cable_desc[] = {
* JTAG enabled by default, ESP_EN pulled up, * JTAG enabled by default, ESP_EN pulled up,
* inverted by U4 and enabling JTAG by U5 * inverted by U4 and enabling JTAG by U5
*/ */
{
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6010, .product = 0x6010,
.interface = INTERFACE_A, .interface = INTERFACE_A,
@ -289,17 +293,17 @@ cable_desc_t cable_desc[] = {
* Indicate Mode-SW set to SWD with "-e" on the command line * Indicate Mode-SW set to SWD with "-e" on the command line
* TRST is Push/Pull, not OD! * TRST is Push/Pull, not OD!
* PIN4 (DB5) ----------- TRST * PIN4 (DB5) ----------- TRST
* SRST is Push/Pull, not OD! Keep DDR set. * nRST is Push/Pull, not OD! Keep DDR set.
* PIN5 (DB5) ----------- NRST */ * PIN5 (DB5) ----------- NRST */
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6010,/*FT2232H*/ .product = 0x6010,/*FT2232H*/
.interface = INTERFACE_B, .interface = INTERFACE_B,
.init.data_high = PIN4 | PIN5, /* High on PIN4/5 */ .init.data_high = PIN4 | PIN5, /* High on PIN4/5 */
.init.ddr_high = PIN4 | PIN5, /* Output on PIN4/5 */ .init.ddr_high = PIN4 | PIN5, /* Output on PIN4/5 */
.assert_srst.data_low = ~PIN5, .assert_nrst.data_low = ~PIN5,
.assert_srst.ddr_low = PIN5, .assert_nrst.ddr_low = PIN5,
.deassert_srst.data_low = PIN5, .deassert_nrst.data_low = PIN5,
.deassert_srst.ddr_low = PIN5, .deassert_nrst.ddr_low = PIN5,
.target_voltage_cmd = GET_BITS_LOW, .target_voltage_cmd = GET_BITS_LOW,
.description = "Tigard", .description = "Tigard",
.name = "tigard" .name = "tigard"
@ -313,17 +317,18 @@ cable_desc_t cable_desc[] = {
.vendor = 0x0403, .vendor = 0x0403,
.product = 0x6010, .product = 0x6010,
.interface = INTERFACE_A, .interface = INTERFACE_A,
.assert_srst.data_low = ~PIN5, .assert_nrst.data_low = ~PIN5,
.assert_srst.ddr_low = PIN5, .assert_nrst.ddr_low = PIN5,
.deassert_srst.data_low = PIN5, .deassert_nrst.data_low = PIN5,
.deassert_srst.ddr_low = ~PIN5, .deassert_nrst.ddr_low = ~PIN5,
.bb_swdio_in_port_cmd = GET_BITS_LOW, .bb_swdio_in_port_cmd = GET_BITS_LOW,
.bb_swdio_in_pin = MPSSE_CS, .bb_swdio_in_pin = MPSSE_CS,
.name = "hifive1" .name = "hifive1"
}, },
{ /* https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/ {
/* https://www.olimex.com/Products/ARM/JTAG/ARM-USB-TINY-H/
* *
* schmeatics not available * schematics not available
*/ */
.vendor = 0x15b1, .vendor = 0x15b1,
.product = 0x002a, .product = 0x002a,
@ -332,10 +337,10 @@ cable_desc_t cable_desc[] = {
.init.ddr_low = PIN4 | PIN5, .init.ddr_low = PIN4 | PIN5,
.init.data_high = PIN2 | PIN4, .init.data_high = PIN2 | PIN4,
.init.ddr_high = PIN4, .init.ddr_high = PIN4,
.assert_srst.data_high = ~PIN2, .assert_nrst.data_high = ~PIN2,
.assert_srst.ddr_high = PIN2, .assert_nrst.ddr_high = PIN2,
.deassert_srst.data_high = PIN2, .deassert_nrst.data_high = PIN2,
.deassert_srst.ddr_high = ~PIN2, .deassert_nrst.ddr_high = ~PIN2,
.name = "arm-usb-tiny-h", .name = "arm-usb-tiny-h",
.description = "Olimex OpenOCD JTAG ARM-USB-TINY-H", .description = "Olimex OpenOCD JTAG ARM-USB-TINY-H",
}, },
@ -532,26 +537,26 @@ static void libftdi_set_data(data_desc_t* data)
void libftdi_nrst_set_val(bool assert) void libftdi_nrst_set_val(bool assert)
{ {
if (assert) if (assert)
libftdi_set_data(&active_cable->assert_srst); libftdi_set_data(&active_cable->assert_nrst);
else else
libftdi_set_data(&active_cable->deassert_srst); libftdi_set_data(&active_cable->deassert_nrst);
} }
bool libftdi_nrst_get_val(void) bool libftdi_nrst_get_val(void)
{ {
uint8_t cmd[1] = {0}; uint8_t cmd[1] = {0};
uint8_t pin = 0; uint8_t pin = 0;
if (active_cable->srst_get_port_cmd && active_cable->srst_get_pin) { if (active_cable->nrst_get_port_cmd && active_cable->nrst_get_pin) {
cmd[0]= active_cable->srst_get_port_cmd; cmd[0] = active_cable->nrst_get_port_cmd;
pin = active_cable->srst_get_pin; pin = active_cable->nrst_get_pin;
} else if (active_cable->assert_srst.data_low && } else if (active_cable->assert_nrst.data_low &&
active_cable->assert_srst.ddr_low) { active_cable->assert_nrst.ddr_low) {
cmd[0] = GET_BITS_LOW; cmd[0] = GET_BITS_LOW;
pin = active_cable->assert_srst.data_low; pin = active_cable->assert_nrst.data_low;
} else if (active_cable->assert_srst.data_high && } else if (active_cable->assert_nrst.data_high &&
active_cable->assert_srst.ddr_high) { active_cable->assert_nrst.ddr_high) {
cmd[0] = GET_BITS_HIGH; cmd[0] = GET_BITS_HIGH;
pin = active_cable->assert_srst.data_high; pin = active_cable->assert_nrst.data_high;
} else { } else {
return false; return false;
} }

View File

@ -60,19 +60,19 @@ typedef struct cable_desc_s {
/* Bus data to allow bitbanging switched SWD write. /* Bus data to allow bitbanging switched SWD write.
* TMS is routed to MPSSE_CS.*/ * TMS is routed to MPSSE_CS.*/
pin_settings_t bb_swd_write; pin_settings_t bb_swd_write;
/* dbus_data, dbus_ddr, cbus_data, cbus_ddr value to assert SRST. /* dbus_data, dbus_ddr, cbus_data, cbus_ddr value to assert nRST.
* E.g. with CBUS Pin 1 low, * E.g. with CBUS Pin 1 low,
* give data_high = ~PIN1, ddr_high = PIN1 */ * give data_high = ~PIN1, ddr_high = PIN1 */
data_desc_t assert_srst; data_desc_t assert_nrst;
/* Bus_data, dbus_ddr, cbus_data, cbus_ddr value to release SRST. /* Bus_data, dbus_ddr, cbus_data, cbus_ddr value to release nRST.
* E.g. with CBUS Pin 1 floating with internal pull up, * E.g. with CBUS Pin 1 floating with internal pull up,
* give data_high = PIN1, ddr_high = ~PIN1 */ * give data_high = PIN1, ddr_high = ~PIN1 */
data_desc_t deassert_srst; data_desc_t deassert_nrst;
/* Command to read back SRST. If 0, port from assert_srst is used*/ /* Command to read back NRST. If 0, port from assert_nrst is used*/
uint8_t srst_get_port_cmd; uint8_t nrst_get_port_cmd;
/* PIN to read back as SRST. if 0 port from assert_srst is ised. /* PIN to read back as NRST. if 0 port from assert_nrst is ised.
* Use PINX if active high, use Complement (~PINX) if active low*/ * Use PINX if active high, use Complement (~PINX) if active low*/
uint8_t srst_get_pin; uint8_t nrst_get_pin;
/* Bbus data for pure MPSSE SWD read. /* Bbus data for pure MPSSE SWD read.
* Use together with swd_write if by some bits on DBUS, * Use together with swd_write if by some bits on DBUS,
* SWDIO can be routed to TDI and TDO. * SWDIO can be routed to TDI and TDO.