Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


stlink_usb_open(): claim interface failed

I’ve been trying to solve this issue I’m having with flashing my STM32 nucleo F303re dev board. I was able to flash the board just fine. A day later I started getting the below error. I’ve tried a different USB cable, Ive made sure that it’s using st link v2.1. I’m pretty new to MCU. Here is the error:


Debug: 252 5 command.c:364 register_command_handler(): registering ‘ocd_ps’...
Debug: 253 5 command.c:364 register_command_handler(): registering ‘ocd_test_mem_access’...
Debug: 254 5 hla_interface.c:109 hl_interface_init(): hl_interface_init
Debug: 255 5 hla_layout.c:89 hl_layout_init(): hl_layout_init
Debug: 256 5 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 257 5 core.c:1601 adapter_khz_to_speed(): have interface set up
Debug: 258 5 core.c:1598 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 259 5 core.c:1601 adapter_khz_to_speed(): have interface set up
Info : 260 5 core.c:1386 adapter_init(): clock speed 950 kHz
Debug: 261 5 openocd.c:140 handle_init_command(): Debug Adapter init complete
Debug: 262 5 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 263 5 command.c:143 script_debug(): command - ocd_transport ocd_transport init
Debug: 265 5 transport.c:239 handle_transport_init(): handle_transport_init
Debug: 266 5 hla_transport.c:152 hl_transport_init(): hl_transport_init
Debug: 267 5 hla_transport.c:169 hl_transport_init(): current transport hla_swd
Debug: 268 5 hla_interface.c:42 hl_interface_open(): hl_interface_open
Debug: 269 5 hla_layout.c:40 hl_layout_open(): hl_layout_open
Debug: 270 5 stlink_usb.c:2070 stlink_usb_open(): stlink_usb_open
Debug: 271 5 stlink_usb.c:2086 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x374b serial:
Debug: 272 23 stlink_usb.c:2106 stlink_usb_open(): claim interface failed
Debug: 273 23 hla_layout.c:47 hl_layout_open(): failed
Debug: 274 23 command.c:626 run_command(): Command failed with error code -4
User : 275 23 command.c:687 command_run_line(): in procedure ‘program’
in procedure ‘init’ called at file “embedded:startup.tcl”, line 485
in procedure ‘ocd_bouncer’
Debug: 276 23 command.c:626 run_command(): Command failed with error code -4
Debug: 277 23 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_echo ** OpenOCD init failed **
Debug: 278 23 command.c:143 script_debug(): command - echo ocd_echo ** OpenOCD init failed **
User : 280 23 command.c:762 jim_echo(): ** OpenOCD init failed **
Debug: 281 23 command.c:143 script_debug(): command - ocd_command ocd_command type ocd_shutdown error
Debug: 282 23 command.c:143 script_debug(): command - shutdown ocd_shutdown error
User : 284 23 server.c:652 handle_shutdown_command(): shutdown command invoked
Debug: 285 23 command.c:626 run_command(): Command failed with error code -4
User : 286 23 command.c:687 command_run_line():
Debug: 287 23 hla_interface.c:117 hl_interface_quit(): hl_interface_quit


Here is what what running dmesg (I’m using a linux OS) gives after disconnection the USB and reconnection the USB to the dev board:


30519.796724 usb 3-1: USB disconnect, device number 17
30523.219378 usb 3-1: new full-speed USB device number 18 using xhci_hcd
30523.394684 usb 3-1: New USB device found, idVendor=0483, idProduct=374b
30523.394692 usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
30523.394697 usb 3-1: Product: STM32 STLink
30523.394701 usb 3-1: Manufacturer: STMicroelectronics
30523.394705 usb 3-1: SerialNumber: 066BFF564948897767122421
30523.837670 cdc_acm 3-1:1.2: ttyACM0: USB ACM device
30523.840807 usb-storage 3-1:1.1: USB Mass Storage device detected
30523.840809 usbcore: registered new interface driver cdc_acm
30523.840810 cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
30523.841244 scsi host6: usb-storage 3-1:1.1
30523.841343 usbcore: registered new interface driver usb-storage
30523.843346 usbcore: registered new interface driver uas
30524.850508 scsi 6:0:0:0: Direct-Access MBED microcontroller 1.0 PQ: 0 ANSI: 2
30524.851305 sd 6:0:0:0: Attached scsi generic sg2 type 0
30524.851804 sd 6:0:0:0: sdc 80 512-byte logical blocks: (41.0 kB/40.0 KiB)
30524.852074 sd 6:0:0:0: sdc Write Protect is off
30524.852076 sd 6:0:0:0: sdc Mode Sense: 03 00 00 00
30524.852252 sd 6:0:0:0: sdc No Caching mode page found
30524.852262 sd 6:0:0:0: sdc Assuming drive cache: write through
30524.869166 sd 6:0:0:0: sdc Attached SCSI removable disk

I’m new to openOCD and ST link so any guidance on what is going on there would be much appreciated!