2024-02-28 04:37 AM
Hi,
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
**openocd.cfg
**interface/ftdi.cfg
#include "main.h"
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
void configure_JTAG_pins(void);
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_GPIO_Init();
configure_JTAG_pins();
while (1)
{
HAL_GPIO_TogglePin(GPIOG, GPIO_PIN_14);
HAL_Delay(1000);
}
}
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);
}
2024-02-28 06:50 PM
Just get ST-LINK v3 and connect in SWD mode. Don't harm yourself (and the TFDI cable).