ftdi swd: disable SWD output pin during input

* 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
This commit is contained in:
Patrick Stewart 2014-08-27 17:17:27 +01:00 committed by Paul Fertser
parent ab25205bbf
commit 1003bc7be7
4 changed files with 130 additions and 2 deletions

View 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);
}
}
}
/**

View File

@ -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]

View File

@ -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

View File

@ -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