STM32F0DISCOVERY and latest OpenOCD

Hi,

For past three days I’m trying to make STM32F0DISCOVERY board (supported in dev version) to work on Linux without success.

Whatever I’m making I always end-up with following error (-d 1):

Debug: 162 14 stlink_usb.c:1145 stlink_usb_open(): stlink_usb_open 
Debug: 163 14 stlink_usb.c:1160 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x3748 
Debug: 164 20 stlink_usb.c:419 stlink_usb_version(): STLINK v2 JTAG v15 API v2 SWIM v0 VID 0x0483 PID 0x3748 
Debug: 165 22 stlink_usb.c:561 stlink_usb_init_mode(): MODE: 0x02 
Debug: 166 25 stlink_usb.c:593 stlink_usb_init_mode(): MODE: 0x01 
Debug: 167 27 stlink_usb.c:372 stlink_usb_error_check(): status error: 9 ('unknown') 
Error: 168 27 stlink_usb.c:1241 stlink_usb_open(): init mode failed 
Debug: 169 27 stlink_layout.c:50 stlink_layout_open(): failed 
Debug: 170 27 command.c:628 run_command(): Command failed with error code -4

Board works perfectly on Windows and Keil enviroment, however I need to run this on Linux.

I’ve check permissions in /dev, different builds from past, hell I even build openocd with libusb on Windows 7 :slight_smile:

Error was exactly the same.

Anyone have idea what might be wrong ??

Thanks in advance :slight_smile:

Regards,

You’re using 0.6.0 then? Sorry, I’ve not seen anything like those particular errors. It is mostly working on my Linux Mint install. I’ll paste in the openocd.cfg I’m using. I think most of the weirdness is because I tried to keep 0.5.0 as the default. Not sure though.

set LIBD060 /home/hfs2/local/share/openocd/scripts
## source [find board/stm32f4discovery.cfg]
# source ${LIBD060}/board/stm32f4discovery.cfg
source ${LIBD060}/interface/stlink-v2.cfg
# source ${LIBD060}/target/stm32f4x_stlink.cfg
#
# STM32f4x stlink pseudo target
#

set CHIPNAME stm32f4x
set CPUTAPID 0x2ba01477
set WORKAREASIZE 0x10000

# source [find target/stm32_stlink.cfg]
source ${LIBD060}/target/stm32_stlink.cfg

# stm32f4x family uses stm32f2x driver
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME stm32f2x 0 0 0 0 $_TARGETNAME

gdb_port 3333
telnet_port 4444
tcl_port 8765

As I said, mostly working. OpenOCD seems to work ok via the telnet interface. I can’t remember now the exact nature of the problems I was having - I think it had to do with being able to stop at a breakpoint after reset via gdb.

Lately I’ve been using the [gdbserver and flash utility supplied by [the ST team?]. I do miss some of the telnet features of OpenOCD but the interface to gdb seems more stable.](GitHub - stlink-org/stlink: Open source STM32 MCU programming toolset)

What version of firmware on STLINK device you have ?

What I noticed is that stlink you mentioned also doesn’t work and it worked in past.

The only difference is that I made firmware upgrade to STLINK on windows. Previous one was V14 now it it V15, and I believe that might be connected to my problem.

Does anyone can check what firmware version they have on STM32F0DISCOVERY board STLINK interface ?

This can be seen on debug when openocd is run with “-d 1” option:

Debug: 164 19 stlink_usb.c:419 stlink_usb_version(): STLINK v2 JTAG v15 API v2 SWIM v0 VID 0x0483 PID 0x3748

Maybe there were some changes made by STM and OpenOCD doesn’t work with latest release ?

I would like to know if someone is successfuly using OpenOCD with firmware “v15”, to rule out this posibility.

v14 for me. I completely missed the reference to -d 1 in your first post. Lots of output!

Debug: 162 33 stlink_layout.c:43 stlink_layout_open(): stlink_layout_open
Debug: 163 33 stlink_usb.c:1005 stlink_usb_open(): stlink_usb_open
Debug: 164 33 stlink_usb.c:1020 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x3748
Debug: 165 113 stlink_usb.c:413 stlink_usb_version(): STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Debug: 166 115 stlink_usb.c:555 stlink_usb_init_mode(): MODE: 0x02
Debug: 167 118 stlink_usb.c:587 stlink_usb_init_mode(): MODE: 0x01
Debug: 168 121 stlink_usb.c:620 stlink_usb_init_mode(): MODE: 0x02
Debug: 169 121 stlink_interface.c:53 stlink_interface_init_target(): stlink_interface_init_target
Debug: 170 123 stlink_usb.c:647 stlink_usb_idcode(): IDCODE: 0x2BA01477
Debug: 171 123 openocd.c:145 handle_init_command(): Examining targets...
Debug: 172 123 arm_adi_v5.c:1097 ahbap_debugport_init():  
Debug: 173 123 arm_adi_v5.c:1103 ahbap_debugport_init(): No low level jtag hardware found
Debug: 174 123 stm32_stlink.c:631 stm32_stlink_read_memory(): stm32_stlink_read_memory 0xe000ed00 4 1
Debug: 175 125 target.c:1908 target_read_u32(): address: 0xe000ed00, value: 0x410fc241
Debug: 176 125 cortex_m.c:1788 cortex_m3_examine(): Cortex-M4 r0p1 processor detected
Debug: 177 125 cortex_m.c:1789 cortex_m3_examine(): cpuid: 0x410fc241

I have used stlink/v1 and stlink/v2 with both firmware versions v14 and v15.

you still getting problems ?

Spen