cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect STM32H745I-DISCO with openOCD using openOCD ?

VLacr.1
Associate II

Hello,

I am not able to connect my ubuntu 20.04 laptop to a STM32H745I-DISCO board using openocd.

```

$ openocd -f board/stm32h745i-disco.cfg

Open On-Chip Debugger 0.11.0+dev-00450-ge67ff42de (2022-01-14-09:58)

Licensed under GNU GPL v2

For bug reports, read

   http://openocd.org/doc/doxygen/bugs.html

Error: The specified debug interface was not found (hla)

The following debug adapters are available:

1: jlink

2: buspirate

```

I tried with the following revisions of openocd:

  • revision 0.11 from official repository
  • master version from ST Fork

I see the interface on my computer:

```

$ lsusb | grep -i stm

Bus 001 Device 016: ID 0483:374e STMicroelectronics STLINK-V3

```

Did I missed something ?

3 REPLIES 3
Andreas Bolsch
Lead II

Looks like you've build both variants by yourself? Then most probably the hla interface wasn't built in (maybe some dependency was missing so that 'configure' script did exclude it automatically --- check configure's output).

vlacr.11
Associate II

Thanks for your answer Andreas. I tried to compile with:

```

./configure --enable-stlink

```

The ST Fork of openOCD doesn't compile:

```

./src/helper/types.h:194:9: error: ‘misc_items’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

 194 | buf[0] = (uint8_t) (val >> 0);

     | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~

src/jtag/drivers/stlink_usb.c:4595:20: note: ‘misc_items’ was declared here

 4595 | unsigned int cnt, misc_items;

     |                   ^~~~~~~~~~

```

However, the official openOCD compiles with this option.

Going back to the board with this new openocd, it seems that I have at least an access right issue:

```

$ openocd -f board/stm32h745i-disco.cfg

Open On-Chip Debugger 0.11.0-dirty (2022-01-17-09:32)

Licensed under GNU GPL v2

For bug reports, read

   http://openocd.org/doc/doxygen/bugs.html

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : clock speed 1800 kHz

Error: libusb_open() failed with LIBUSB_ERROR_ACCESS

Error: open failed

```

When I try to bypass this issue, I run into another one:

```

$ sudo openocd -f board/stm32h745i-disco.cfg

Open On-Chip Debugger 0.11.0-dirty (2022-01-17-09:32)

Licensed under GNU GPL v2

For bug reports, read

   http://openocd.org/doc/doxygen/bugs.html

Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : clock speed 1800 kHz

Info : STLINK V3J3M2 (API v3) VID:PID 0483:374E

Info : Target voltage: 3.279681

Error: init mode failed (unable to connect to the target)

```

Any clue ?

GTelk
Associate II

There is an unititialized variable in stlink_usb.c, see https://github.com/STMicroelectronics/OpenOCD/pull/13