ftdi swd: disable SWD output pin during input 74/2274/7
authorPatrick Stewart <patstew@gmail.com>
Wed, 27 Aug 2014 16:17:27 +0000 (17:17 +0100)
committerPaul Fertser <fercerpav@gmail.com>
Sat, 13 Jan 2018 11:37:13 +0000 (11:37 +0000)
 * Disables the data output pin while SWD is reading, so that a simple FTDI
   SWD interface can be made by connecting TCK to SWD_CLK and TDI+TDO directly
   to SWDIO. Enabled by setting SWDIO_OE to 0.

Change-Id: I7d3b71cf3f4eea163cb320aff69ed95d219190bd
Signed-off-by: Patrick Stewart <patstew@gmail.com>
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
Reviewed-on: http://openocd.zylin.com/2274
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Tested-by: jenkins
src/jtag/drivers/ftdi.c
tcl/board/nordic_nrf52_ftx232.cfg [new file with mode: 0644]
tcl/interface/ftdi/ft232h-module-swd.cfg [new file with mode: 0644]
tcl/interface/ftdi/minimodule-swd.cfg [new file with mode: 0644]

index 32876bac5905bf5443995cf49d1c52fccebb6cca..e69707e5a70ee31236b1b010ef9908b2f5af49f2 100644 (file)
@@ -1064,8 +1064,19 @@ static int ftdi_swd_init(void)
 static void ftdi_swd_swdio_en(bool enable)
 {
        struct signal *oe = find_signal_by_name("SWDIO_OE");
-       if (oe)
-               ftdi_set_signal(oe, enable ? '1' : '0');
+       if (oe) {
+               if (oe->data_mask)
+                       ftdi_set_signal(oe, enable ? '1' : '0');
+               else {
+                       /* Sets TDI/DO pin (pin 2) to input during rx when both pins are connected
+                          to SWDIO */
+                       if (enable)
+                               direction |= jtag_direction_init & 0x0002U;
+                       else
+                               direction &= ~0x0002U;
+                       mpsse_set_data_bits_low_byte(mpsse_ctx, output & 0xff, direction & 0xff);
+               }
+       }
 }
 
 /**
diff --git a/tcl/board/nordic_nrf52_ftx232.cfg b/tcl/board/nordic_nrf52_ftx232.cfg
new file mode 100644 (file)
index 0000000..938efed
--- /dev/null
@@ -0,0 +1,11 @@
+#
+# nordic module NRF52 (nRF52832/52840) attached to an adafruit ft232h module
+# or any FT232H/FT2232H/FT4232H based board/module
+#
+
+source [find interface/ftdi/ft232h-module-swd.cfg]
+#source [find interface/ftdi/minimodule-swd.cfg]
+
+transport select swd
+
+source [find target/nrf52.cfg]
diff --git a/tcl/interface/ftdi/ft232h-module-swd.cfg b/tcl/interface/ftdi/ft232h-module-swd.cfg
new file mode 100644 (file)
index 0000000..d2bd1da
--- /dev/null
@@ -0,0 +1,52 @@
+#
+# ADAFRUIT FTDI FT232H as a SWD direct connect interface
+# Any FT232H based board may work
+#
+# http://www.ftdichip.com/Products/ICs/FT232H.htm
+#
+#
+
+interface ftdi
+
+ftdi_vid_pid 0x0403 0x6014
+
+# data MSB..LSB       direction (1:out) MSB..LSB
+# 0000'0000'0011'0000 0000'0000'0011'1011
+ftdi_layout_init 0x0030 0x003b
+# 0xfff8 0xfffb
+# Those signal are only required on some platforms or may required to be
+# enabled explicitely (e.g. nrf5x chips).
+ftdi_layout_signal nSRST -data 0x0010 -oe 0x0010
+ftdi_layout_signal nTRST -data 0x0020 -oe 0x0020
+
+# swd enable
+ftdi_layout_signal SWD_EN -data 0
+# tri-state (configure as input) TDO/TIO when reading
+ftdi_layout_signal SWDIO_OE -data 0
+
+transport select swd
+
+# re-configure TDO as tri-state
+#ftdi_layout_signal TDO -data 0x0002 -oe 0x0002
+#ftdi_layout_signal TDI -data 0x0004
+
+# Adafruit      FT232H    JTAG       SWD
+# Name  Pin     Name      Func       Func
+#  D0   J1-3    ADBUS0    TCK        SWDCLK
+#  D1   J1-4    ADBUS1    TDO/DI     SWDIO
+#  D2   J1-5    ADBUS2    TDI/DO     SWDIO
+#  D3   J1-6    ADBUS3    TMS        N/A
+#  D4   J1-7    ADBUS4    (GPIOL0)   /nSRST  optional module reset
+#  D5   J1-8    ADBUS5    (GPIOL1)   /nTRST  optional target reset
+#  D6   J1-9    ADBUS6    (GPIOL2)
+#  D7   J1-10   ADBUS7    (GPIOL3)
+#  C0   J2-1    ACBUS0    (GPIOH0)
+#  C1   J2-2    ACBUS1    (GPIOH1)
+#  C2   J2-3    ACBUS2    (GPIOH2)
+#  C3   J2-4    ACBUS3    (GPIOH3)
+#  C4   J2-5    ACBUS4    (GPIOH4)
+#  C5   J2-6    ACBUS5    (GPIOH5)
+#  C6   J2-7    ACBUS6    (GPIOH6)
+#  C7   J2-8    ACBUS7    (GPIOH7)
+#  C8   J2-9    ACBUS8
+#  C9   J2-10   ACBUS9
diff --git a/tcl/interface/ftdi/minimodule-swd.cfg b/tcl/interface/ftdi/minimodule-swd.cfg
new file mode 100644 (file)
index 0000000..5f0b212
--- /dev/null
@@ -0,0 +1,54 @@
+#
+Supports SWD using the FT2232H or FT4232H minimodule.
+# Each can support 2 SWD interfaces.
+#
+# FT2232H or FT4232H minimodule channel 0 (Channel A)
+# Connector  FTDI              Target
+# Pin        Name
+# ---------  ------            ------
+# CN2-11     VIO               VDD_IO (Or connect to CN2-5 on the minimodule instead for a 3V3 interface)
+# CN2-2      GND               GND
+# CN2-7      ADBUS0 (TCK)      SWCLK
+# CN2-9      ADBUS2 (TDI/TDO)  SWDIO
+# CN2-10     ADBUS1 (TDO/TDI)  SWDIO
+# CN2-14     ADBUS4 (GPIOL0)   nRESET
+#
+# FT2232H minimodule channel 1 (Channel B)
+# FTDI       Target
+# ----       ------
+# CN2-11  -  VDD_IO
+# CN2-2   -  GND
+# CN3-26  -  SWCLK
+# CN3-25  -  SWDIO
+# CN3-24  -  SWDIO
+# CN3-21  -  nRESET
+#
+# FT4232H minimodule channel 1 (Channel B)
+# FTDI       Target
+# ----       ------
+# CN2-11  -  VDD_IO
+# CN2-2   -  GND
+# CN2-18  -  SWCLK
+# CN2-17  -  SWDIO
+# CN2-20  -  SWDIO
+# CN2-22  -  nRESET
+#
+
+interface ftdi
+
+#Select your module type and channel
+
+#ftdi_device_desc "FT2232H MiniModule"
+ftdi_vid_pid 0x0403 0x6010
+#ftdi_channel 1
+
+#ftdi_device_desc "FT4232H MiniModule"
+#ftdi_vid_pid 0x0403 0x6011
+#ftdi_channel 1
+
+ftdi_layout_init 0x0000 0x000b
+ftdi_layout_signal nSRST -data 0x0010 -oe 0x0010
+ftdi_layout_signal SWD_EN -data 0
+ftdi_layout_signal SWDIO_OE -data 0
+
+transport select swd

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)