Showing results for 
Search instead for 
Did you mean: 

Unable to connect with STM32F429ZI using Openocd via C232H FTDI cable



I am a newbie in using openocd and STM32 MCUs, I am trying to connect iwith STM32F429ZI board from my PC using Openocd via C232H FTDI cable using its JTAG interface.

I am encountering JTAG scan chain error, while running openocd -f openocd.cfg


I have attached my interface.cfg and target.cfg, please take some time of yours to go through them completely


source C:/Users/slakshmi_narayanan/openocd/xpack-openocd-0.12.0-2/openocd/scripts/interface/ftdi.cfg
source C:/Users/slakshmi_narayanan/openocd/xpack-openocd-0.12.0-2/openocd/scripts/target/stm32f4x.cfg



adapter driver ftdi
ftdi device_desc "C232HM-DDHSL-0"
ftdi vid_pid 0x0403 0x6014
ftdi channel 0
adapter speed 2000
ftdi layout_init 0x0078 0x017b
ftdi tdo_sample_edge falling
ftdi layout_signal nTRST -ndata 0x0010 -noe 0x0040
ftdi layout_signal nSRST -ndata 0x0020 -noe 0x0040
#ftdi layout_signal TDI -data 0x0800
#ftdi layout_signal TDO -data 0x0400
#ftdi layout_signal TCK -data 0x0200
#ftdi layout_signal TMS -data 0x0100
transport select jtag

set _swj_mode 0b011   ;# This is an example, replace with the desired SWJ mode
$_CHIPNAME.dap configure -event DebugSetup {
    $_CHIPNAME.dap swj_mode $_swj_mode
I have added the above lines to the exsisting stm32f4x.cfg configuration supported by xpack scripts. Remaining is completely the same. 
Since STM32F429ZI does not have dedicated JTAG pins I am enabling the GPIO pins PA13 - TMS, PA14 - TCK, PA15 - TDI and PB3 - TDO to behave as the JTAG pins. I am running a firmware that enables the mentioned pins to act as JTAG pins. 



#include "main.h"

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

void configure_JTAG_pins(void);

int main(void)






  while (1)


    HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_14);




void configure_JTAG_pins(void) {

    GPIO_InitTypeDef GPIO_InitStruct;

    __HAL_RCC_GPIOA_CLK_ENABLE(); // Assuming JTAG pins are on GPIOA

    __HAL_RCC_GPIOB_CLK_ENABLE(); // Assuming TDO is on GPIOB


    // Configure JTAG pins (PA13, PA14, PA15)

    GPIO_InitStruct.Pin = GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

    GPIO_InitStruct.Pull = GPIO_PULLUP;

    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;

    GPIO_InitStruct.Alternate = 0x07; // Select JTAG/SWD alternate function

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);


    // Configure TDO pin (PB3)

    GPIO_InitStruct.Pin = GPIO_PIN_3; // TDO pin on PB3

    //GPIO_InitStruct.Alternate = GPIO_AF9; // Select alternate function 9

    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);


Even after this setup I am getting JTAG scan chain error, I am not understanding what or where it is going wrong. 

I'll be glad if someone could help me resolve this error. 

Pavel A.
Evangelist III

Just get ST-LINK v3 and connect in SWD mode. Don't harm yourself (and the TFDI cable).