OpenOCD fails to detect connect STM32F4Discovery (STLINK-V2)

Hello All,

This is my first post on the forum.

I am using an STM32F4Discovery Board along with ChibiOS/RT on a Windows system (Freddie Choppin’s binaries), with a development platform of ChibiStudio (http://forum.chibios.org/phpbb/viewtopic.php?f=13&t=557). It does not seem to work with my system. Whenever I try to start it up, I encounter the following errors:

Brief Log:

Open On-Chip Debugger 0.6.0 (2012-09-07-10:48)
Licensed under GNU GPL v2
For bug reports, read
   http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
libusbx: warning [windows_get_device_list] '\\.\USB#VID_0461&PID_4DFA#5&540BBBE&0&1' was only detected in late pass (newly connected device?) - ignoring
libusbx: warning [windows_get_device_list] '\\.\USB#VID_0483&PID_3748#5&540BBBE&0&3' was only detected in late pass (newly connected device?) - ignoring
Error: open failed
in procedure 'transport'
in procedure 'init'

Verbose Log: (-d 1)

Open On-Chip Debugger 0.6.0 (2012-09-07-10:48)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
User : 11 2 command.c:549 command_print(): debug_level: 3
Debug: 12 2 configuration.c:45 add_script_search_dir(): adding C:/ChibiStudio/tools/openocd/bin-x64/..
Debug: 13 3 configuration.c:45 add_script_search_dir(): adding C:/ChibiStudio/tools/openocd/bin-x64/../share/openocd/scripts
Debug: 14 3 configuration.c:45 add_script_search_dir(): adding C:/ChibiStudio/tools/openocd/bin-x64/../scripts
Debug: 15 5 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_telnet_port 4444
Debug: 16 5 command.c:145 script_debug(): command - telnet_port ocd_telnet_port 4444
Debug: 18 5 configuration.c:86 find_file(): found C:/ChibiStudio/tools/openocd/scripts/interface/stlink-v2.cfg
Debug: 19 7 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_interface stlink
Debug: 20 7 command.c:145 script_debug(): command - interface ocd_interface stlink
Debug: 22 7 command.c:369 register_command_handler(): registering 'ocd_stlink_device_desc'...
Debug: 23 7 command.c:369 register_command_handler(): registering 'ocd_stlink_serial'...
Debug: 24 7 command.c:369 register_command_handler(): registering 'ocd_stlink_layout'...
Debug: 25 7 command.c:369 register_command_handler(): registering 'ocd_stlink_vid_pid'...
Debug: 26 8 command.c:369 register_command_handler(): registering 'ocd_stlink_api'...
Debug: 27 8 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_stlink_layout usb
Debug: 28 8 command.c:145 script_debug(): command - stlink_layout ocd_stlink_layout usb
Debug: 30 8 stlink_interface.c:160 stlink_interface_handle_layout_command(): stlink_interface_handle_layout_command
Debug: 31 8 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_stlink_device_desc ST-LINK/V2
Debug: 32 9 command.c:145 script_debug(): command - stlink_device_desc ocd_stlink_device_desc ST-LINK/V2
Debug: 34 9 stlink_interface.c:132 stlink_interface_handle_device_desc_command(): stlink_interface_handle_device_desc_command
Debug: 35 9 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_stlink_vid_pid 0x0483 0x3748
Debug: 36 9 command.c:145 script_debug(): command - stlink_vid_pid ocd_stlink_vid_pid 0x0483 0x3748
Debug: 38 9 stlink_interface.c:188 stlink_interface_handle_vid_pid_command(): stlink_interface_handle_vid_pid_command
Debug: 39 10 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_adapter_khz 1000
Debug: 40 10 command.c:145 script_debug(): command - adapter_khz ocd_adapter_khz 1000
Debug: 42 10 core.c:1625 jtag_config_khz(): handle jtag khz
Debug: 43 10 core.c:1592 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 44 10 core.c:1592 adapter_khz_to_speed(): convert khz to interface specific speed value
User : 45 10 command.c:549 command_print(): adapter speed: 1000 kHz
Debug: 46 11 configuration.c:86 find_file(): found C:/ChibiStudio/tools/openocd/scripts/target/stm32f4x_stlink.cfg
Debug: 47 12 configuration.c:86 find_file(): found C:/ChibiStudio/tools/openocd/bin-x64/../scripts/target/stm32_stlink.cfg
Debug: 48 12 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport select stlink_swd
Debug: 49 12 command.c:145 script_debug(): command - ocd_transport ocd_transport select stlink_swd
Debug: 50 13 stlink_transport.c:179 stlink_transport_select(): stlink_transport_select
Debug: 51 13 command.c:369 register_command_handler(): registering 'ocd_stlink'...
Debug: 52 13 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 53 13 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 54 13 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 55 13 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 56 13 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 57 13 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 58 14 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 59 14 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 60 14 command.c:369 register_command_handler(): registering 'ocd_jtag'...
Debug: 61 14 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_stlink newtap stm32f4x cpu -expected-id 0x2ba01477
Debug: 62 14 command.c:145 script_debug(): command - ocd_stlink ocd_stlink newtap stm32f4x cpu -expected-id 0x2ba01477
Debug: 63 14 stlink_tcl.c:101 jim_stlink_newtap_cmd(): Creating New Tap, Chip: stm32f4x, Tap: cpu, Dotted: stm32f4x.cpu, 2 params
Debug: 64 15 stlink_tcl.c:111 jim_stlink_newtap_cmd(): Processing option: -expected-id
Debug: 65 15 core.c:1323 jtag_tap_init(): Created Tap: stm32f4x.cpu @ abs position 0, irlen 0, capture: 0x0 mask: 0x0
Debug: 66 15 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target create stm32f4x.cpu stm32_stlink -chain-position stm32f4x.cpu
Debug: 67 15 command.c:145 script_debug(): command - ocd_target ocd_target create stm32f4x.cpu stm32_stlink -chain-position stm32f4x.cpu
Debug: 68 15 target.c:1608 target_free_all_working_areas_restore(): freeing all working areas
Debug: 69 15 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 70 15 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 71 16 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 72 16 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 73 16 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 74 16 command.c:369 register_command_handler(): registering 'ocd_arm'...
Debug: 75 16 stm32_stlink.c:301 stm32_stlink_target_create(): stm32_stlink_target_create
Debug: 76 16 stm32_stlink.c:274 stm32_stlink_init_arch_info(): stm32_stlink_init_arch_info
Debug: 77 16 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 78 16 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 79 17 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 80 17 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 81 17 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 82 17 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 83 17 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 84 18 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 85 18 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 86 18 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 87 18 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 88 18 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 89 18 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 90 19 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 91 19 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 92 19 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 93 19 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 94 19 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 95 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 96 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 97 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 98 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 99 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 100 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 101 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 102 20 command.c:369 register_command_handler(): registering 'ocd_stm32f4x.cpu'...
Debug: 103 21 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_stm32f4x.cpu configure -work-area-phys 0x20000000 -work-area-size 0x10000 -work-area-backup 0
Debug: 104 21 command.c:145 script_debug(): command - ocd_stm32f4x.cpu ocd_stm32f4x.cpu configure -work-area-phys 0x20000000 -work-area-size 0x10000 -work-area-backup 0
Debug: 105 21 target.c:1608 target_free_all_working_areas_restore(): freeing all working areas
Debug: 106 21 target.c:1608 target_free_all_working_areas_restore(): freeing all working areas
Debug: 107 21 target.c:1608 target_free_all_working_areas_restore(): freeing all working areas
Debug: 108 22 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_flash bank stm32f4x.flash stm32f2x 0 0 0 0 stm32f4x.cpu
Debug: 109 22 command.c:145 script_debug(): command - ocd_flash ocd_flash bank stm32f4x.flash stm32f2x 0 0 0 0 stm32f4x.cpu
Debug: 111 22 command.c:369 register_command_handler(): registering 'ocd_stm32f2x'...
Debug: 112 22 tcl.c:781 handle_flash_bank_command(): 'stm32f2x' driver usage field missing
Debug: 113 35 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_init
Debug: 114 35 command.c:145 script_debug(): command - init ocd_init
Debug: 116 35 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_target init
Debug: 117 35 command.c:145 script_debug(): command - ocd_target ocd_target init
Debug: 119 35 target.c:1183 handle_target_init_command(): Initializing targets...
Debug: 120 36 stm32_stlink.c:291 stm32_stlink_init_target(): stm32_stlink_init_target
Debug: 121 36 command.c:369 register_command_handler(): registering 'ocd_target_request'...
Debug: 122 36 command.c:369 register_command_handler(): registering 'ocd_trace'...
Debug: 123 36 command.c:369 register_command_handler(): registering 'ocd_trace'...
Debug: 124 36 command.c:369 register_command_handler(): registering 'ocd_fast_load_image'...
Debug: 125 36 command.c:369 register_command_handler(): registering 'ocd_fast_load'...
Debug: 126 36 command.c:369 register_command_handler(): registering 'ocd_profile'...
Debug: 127 36 command.c:369 register_command_handler(): registering 'ocd_virt2phys'...
Debug: 128 37 command.c:369 register_command_handler(): registering 'ocd_reg'...
Debug: 129 37 command.c:369 register_command_handler(): registering 'ocd_poll'...
Debug: 130 37 command.c:369 register_command_handler(): registering 'ocd_wait_halt'...
Debug: 131 37 command.c:369 register_command_handler(): registering 'ocd_halt'...
Debug: 132 37 command.c:369 register_command_handler(): registering 'ocd_resume'...
Debug: 133 37 command.c:369 register_command_handler(): registering 'ocd_reset'...
Debug: 134 37 command.c:369 register_command_handler(): registering 'ocd_soft_reset_halt'...
Debug: 135 37 command.c:369 register_command_handler(): registering 'ocd_step'...
Debug: 136 38 command.c:369 register_command_handler(): registering 'ocd_mdw'...
Debug: 137 38 command.c:369 register_command_handler(): registering 'ocd_mdh'...
Debug: 138 38 command.c:369 register_command_handler(): registering 'ocd_mdb'...
Debug: 139 38 command.c:369 register_command_handler(): registering 'ocd_mww'...
Debug: 140 38 command.c:369 register_command_handler(): registering 'ocd_mwh'...
Debug: 141 38 command.c:369 register_command_handler(): registering 'ocd_mwb'...
Debug: 142 38 command.c:369 register_command_handler(): registering 'ocd_bp'...
Debug: 143 38 command.c:369 register_command_handler(): registering 'ocd_rbp'...
Debug: 144 39 command.c:369 register_command_handler(): registering 'ocd_wp'...
Debug: 145 39 command.c:369 register_command_handler(): registering 'ocd_rwp'...
Debug: 146 39 command.c:369 register_command_handler(): registering 'ocd_load_image'...
Debug: 147 39 command.c:369 register_command_handler(): registering 'ocd_dump_image'...
Debug: 148 39 command.c:369 register_command_handler(): registering 'ocd_verify_image'...
Debug: 149 39 command.c:369 register_command_handler(): registering 'ocd_test_image'...
Debug: 150 39 command.c:369 register_command_handler(): registering 'ocd_reset_nag'...
Debug: 151 39 command.c:369 register_command_handler(): registering 'ocd_ps'...
Debug: 152 40 stlink_interface.c:91 stlink_interface_init(): stlink_interface_init
Debug: 153 40 stlink_layout.c:88 stlink_layout_init(): stlink_layout_init
Debug: 154 40 core.c:1592 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 155 40 core.c:1595 adapter_khz_to_speed(): have interface set up
Debug: 156 40 stlink_interface.c:106 stlink_interface_speed(): stlink_interface_speed: ignore speed 1000
Debug: 157 40 core.c:1592 adapter_khz_to_speed(): convert khz to interface specific speed value
Debug: 158 40 core.c:1595 adapter_khz_to_speed(): have interface set up
Info : 159 40 core.c:1399 adapter_init(): clock speed 1000 kHz
Debug: 160 40 openocd.c:132 handle_init_command(): Debug Adapter init complete
Debug: 161 41 command.c:145 script_debug(): command - ocd_command ocd_command type ocd_transport init
Debug: 162 41 command.c:145 script_debug(): command - ocd_transport ocd_transport init
Debug: 164 41 transport.c:240 handle_transport_init(): handle_transport_init
Debug: 165 41 stlink_transport.c:140 stlink_transport_init(): stlink_transport_init
Debug: 166 41 stlink_transport.c:157 stlink_transport_init(): current transport stlink_swd
Debug: 167 41 stlink_interface.c:41 stlink_interface_open(): stlink_interface_open
Debug: 168 41 stlink_layout.c:43 stlink_layout_open(): stlink_layout_open
Debug: 169 41 stlink_usb.c:1152 stlink_usb_open(): stlink_usb_open
Debug: 170 41 stlink_usb.c:1167 stlink_usb_open(): transport: 1 vid: 0x0483 pid: 0x3748
libusbx: warning [windows_get_device_list] '\\.\USB#VID_0461&PID_4DFA#5&540BBBE&0&1' was only detected in late pass (newly connected device?) - ignoring
libusbx: warning [windows_get_device_list] '\\.\USB#VID_0483&PID_3748#5&540BBBE&0&2' was only detected in late pass (newly connected device?) - ignoring
Error: 171 823 stlink_usb.c:1170 stlink_usb_open(): open failed
Debug: 172 823 stlink_layout.c:50 stlink_layout_open(): failed
Debug: 173 823 command.c:631 run_command(): Command failed with error code -4
User : 174 824 command.c:669 command_run_line(): in procedure 'transport'
Debug: 175 824 command.c:631 run_command(): Command failed with error code -4
User : 176 824 command.c:669 command_run_line(): in procedure 'init'
Debug: 177 825 stlink_interface.c:99 stlink_interface_quit(): stlink_interface_quit

I am able to use my device with the ST-LINK utility provided, and debug using Atollic’s GDB server for ST-LINK.

I tried first with the default driver, then with vanilla libusb-win32 drivers, but none seems to work. Also, I face the same problems with 32-bit as well as 64-bit binaries, on both rc2 and release versions.

OpenOCD is launched with the following parameters:

-f interface/stlink-v2.cfg -f target/stm32f4x_stlink.cfg

My System configuration is a Dell Laptop (i7 Ivy Bridge, HM77 express chipset) which has 4 USB ports, all USB 3.0.

Best Regards

Abhishek

This has been solved: http://www.mail-archive.com/openocd-dev … 02614.html