Hi Antonio, 

Thank you for your answer. 

Indeed, using lower speed or adding an 150Ohm resistor on SWDIO/TCK allowed to 
flash properly the target, good catch !

Now, through the STLINKV3 clone (on the board), I am able to go further away 
but both CubeProgrammer and OpenOcd can't connect to the target. 

Here is the log: 

~~~
Info : 116 8 adapter.c:179 adapter_init(): clock speed 2000 kHz
Debug: 117 8 openocd.c:134 handle_init_command(): Debug Adapter init complete
Debug: 118 8 command.c:155 script_debug(): command - transport init
Debug: 119 8 transport.c:219 handle_transport_init(): handle_transport_init
Debug: 120 8 hla_transport.c:143 hl_transport_init(): hl_transport_init
Debug: 121 8 hla_transport.c:160 hl_transport_init(): current transport hla_swd
Debug: 122 8 hla_interface.c:44 hl_interface_open(): hl_interface_open
Debug: 123 8 hla_layout.c:29 hl_layout_open(): hl_layout_open
Debug: 124 8 stlink_usb.c:3693 stlink_open(): stlink_open
Debug: 125 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3744 serial: 
Debug: 126 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3748 serial: 
Debug: 127 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374b serial: 
Debug: 128 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374d serial: 
Debug: 129 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374e serial: 
Debug: 130 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374f serial: 
Debug: 131 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3752 serial: 
Debug: 132 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3753 serial: 
Debug: 133 8 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3754 serial: 
Info : 134 118 stlink_usb.c:1434 stlink_usb_version(): STLINK V3J7M2B4S1 (API 
v3) VID:PID 0483:3753
Debug: 135 118 stlink_usb.c:1659 stlink_usb_exit_mode(): MODE: 0x01
Info : 136 119 stlink_usb.c:1470 stlink_usb_check_voltage(): Target voltage: 
3.295763
Debug: 137 119 stlink_usb.c:1727 stlink_usb_init_mode(): MODE: 0x01
Debug: 138 119 stlink_usb.c:3093 stlink_dump_speed_map(): Supported clock 
speeds are:
Debug: 139 119 stlink_usb.c:3096 stlink_dump_speed_map(): 24000 kHz
Debug: 140 119 stlink_usb.c:3096 stlink_dump_speed_map(): 8000 kHz
Debug: 141 119 stlink_usb.c:3096 stlink_dump_speed_map(): 3300 kHz
Debug: 142 119 stlink_usb.c:3096 stlink_dump_speed_map(): 1000 kHz
Debug: 143 119 stlink_usb.c:3096 stlink_dump_speed_map(): 200 kHz
Debug: 144 119 stlink_usb.c:3096 stlink_dump_speed_map(): 50 kHz
Debug: 145 119 stlink_usb.c:3096 stlink_dump_speed_map(): 5 kHz
Debug: 146 121 stlink_usb.c:1787 stlink_usb_init_mode(): MODE: 0x02
Debug: 147 121 stlink_usb.c:1130 stlink_usb_error_check(): unknown/unexpected 
STLINK status code 0x5
Debug: 148 121 stlink_usb.c:1130 stlink_usb_error_check(): unknown/unexpected 
STLINK status code 0x5
Debug: 149 121 stlink_usb.c:3781 stlink_open(): Using TAR autoincrement: 1024
Error: 150 121 core.c:620 adapter_system_reset(): BUG: can't assert SRST
Debug: 151 121 hla_interface.c:69 hl_interface_init_target(): 
hl_interface_init_target
Debug: 152 121 stlink_usb.c:2020 stlink_usb_idcode(): IDCODE: 0x2BA01477
Debug: 153 121 command.c:155 script_debug(): command - dap init
Debug: 154 121 arm_dap.c:97 dap_init_all(): Initializing all DAPs ...
Debug: 155 121 openocd.c:151 handle_init_command(): Examining targets...
Debug: 156 121 target.c:1843 target_call_event_callbacks(): target event 19 
(examine-start) for core stm32f4x.cpu
Debug: 157 122 hla_target.c:601 adapter_read_memory(): adapter_read_memory 
0xe000ed00 4 1
Debug: 158 122 stlink_usb.c:1130 stlink_usb_error_check(): unknown/unexpected 
STLINK status code 0x5
Debug: 159 122 target.c:2633 target_read_u32(): address: 0xe000ed00 failed
Debug: 160 122 target.c:1843 target_call_event_callbacks(): target event 20 
(examine-fail) for core stm32f4x.cpu
Warn : 161 122 target.c:802 target_examine(): target stm32f4x.cpu examination 
failed
Debug: 162 122 openocd.c:153 handle_init_command(): target examination failed
Debug: 163 122 command.c:155 script_debug(): command - flash init
Debug: 164 122 tcl.c:1375 handle_flash_init_command(): Initializing flash 
devices...
Debug: 165 122 command.c:155 script_debug(): command - nand init
Debug: 166 122 tcl.c:487 handle_nand_init_command(): Initializing NAND 
devices...
Debug: 167 122 command.c:155 script_debug(): command - pld init
Debug: 168 122 pld.c:194 handle_pld_init_command(): Initializing PLDs...
Debug: 169 122 command.c:155 script_debug(): command - tpiu init
Info : 170 122 gdb_server.c:3791 gdb_target_start(): starting gdb server for 
stm32f4x.cpu on 3333
Info : 171 122 server.c:297 add_service(): Listening on port 3333 for gdb 
connection
~~~

The first error is : `Debug: 147 121 stlink_usb.c:1130 
stlink_usb_error_check(): unknown/unexpected STLINK status code 0x5`

The `BUG: can't assert SRST` is also a log I get using the V3SET. 

I have tried the F446RE with V3SET through the copper traces on the PCB, and it 
works (without resistors). So the signal between V3clone and F446 should be 
fine. 

Comparing signals on logic analyzer, I see that on there are sometimes where 
the target response to e.g. Request DebugPort Read RDBUFF, the timings are 
quite different between V3SET and V3Clone. 

V3Clone also gets 0x0 replies and triggers a line reset afterwards. 

V3Clone and V3SET have different fw versions. I could update V3Clone, but I am 
afraid that the upragder uploads an FW with protected bootloader.

Do you see what I would be missing ? 

Thanks again for your help. 



 


Attachments:

- 
[V3SET_RDBUFF.png](https://sourceforge.net/p/openocd/tickets/_discuss/thread/9c4cf698c4/c233/attachment/V3SET_RDBUFF.png)
 (192.8 kB; image/png)
- 
[V3clone_RDBUFF.png](https://sourceforge.net/p/openocd/tickets/_discuss/thread/9c4cf698c4/c233/attachment/V3clone_RDBUFF.png)
 (205.8 kB; image/png)


---

** [tickets:#373] ST-LINK V3SET fails to enter SWD **

**Status:** new
**Milestone:** 0.11.0
**Created:** Wed Dec 07, 2022 08:57 AM UTC by Tanguy Serrat
**Last Updated:** Wed Dec 07, 2022 05:51 PM UTC
**Owner:** nobody


Hi,

I am running into some issues to connect with a target using an ST-LINK V3SET. 

The setup is :
- Target: STM32F723IEK6
- Interface: SWD (dapdirect_swd / hla_swd)
- OS: 5.13.0-35-generic #40~20.04.1-Ubuntu 
- OpenOcd: Open On-Chip Debugger 0.12.0-rc2+dev-00989-g9501b263e 
(2022-12-06-23:45)
- libusb: libusb-1.0-0-dev/focal,now 2:1.0.23-2build1 amd64

The issue seems to be related to USB problems. 

The error is stlink_usb_error_check(): STLINK_JTAG_GET_IDCODE_ERROR  when 
running :

`openocd -d -f /usr/local/share/openocd/scripts/interface/stlink-dap.cfg -f 
/usr/local/share/openocd/scripts/target/stm32f7x.cfg`

Output is:
~~~
Info : 88 3 server.c:297 add_service(): Listening on port 6666 for tcl 
connections
Info : 89 3 server.c:297 add_service(): Listening on port 4444 for telnet 
connections
Debug: 90 3 command.c:155 script_debug(): command - init
Debug: 91 3 command.c:155 script_debug(): command - target init
Debug: 92 3 command.c:155 script_debug(): command - target names
Debug: 93 3 command.c:155 script_debug(): command - stm32f7x.cpu cget -event 
gdb-flash-erase-start
Debug: 94 3 command.c:155 script_debug(): command - stm32f7x.cpu configure 
-event gdb-flash-erase-start reset init
Debug: 95 3 command.c:155 script_debug(): command - stm32f7x.cpu cget -event 
gdb-flash-write-end
Debug: 96 3 command.c:155 script_debug(): command - stm32f7x.cpu configure 
-event gdb-flash-write-end reset halt
Debug: 97 3 command.c:155 script_debug(): command - stm32f7x.cpu cget -event 
gdb-attach
Debug: 98 3 command.c:155 script_debug(): command - stm32f7x.cpu configure 
-event gdb-attach halt 1000
Debug: 99 3 target.c:1657 handle_target_init_command(): Initializing targets...
Debug: 100 3 semihosting_common.c:109 semihosting_common_init():  
Debug: 101 3 stlink_usb.c:5081 stlink_dap_init(): stlink_dap_init()
Debug: 102 3 stlink_usb.c:3693 stlink_open(): stlink_open
Debug: 103 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3744 serial: 
Debug: 104 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3748 serial: 
Debug: 105 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374b serial: 
Debug: 106 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374d serial: 
Debug: 107 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374e serial: 
Debug: 108 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x374f serial: 
Debug: 109 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3752 serial: 
Debug: 110 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3753 serial: 
Debug: 111 3 stlink_usb.c:3705 stlink_open(): transport: 4 vid: 0x0483 pid: 
0x3754 serial: 
Info : 112 7 stlink_usb.c:1434 stlink_usb_version(): STLINK V3J10M3B5S1 (API 
v3) VID:PID 0483:3753
Debug: 113 7 stlink_usb.c:1659 stlink_usb_exit_mode(): MODE: 0x01
Info : 114 7 stlink_usb.c:1470 stlink_usb_check_voltage(): Target voltage: 
3.347832
Debug: 115 7 stlink_usb.c:1727 stlink_usb_init_mode(): MODE: 0x01
Debug: 116 7 stlink_usb.c:3093 stlink_dump_speed_map(): Supported clock speeds 
are:
Debug: 117 7 stlink_usb.c:3096 stlink_dump_speed_map(): 24000 kHz
Debug: 118 7 stlink_usb.c:3096 stlink_dump_speed_map(): 8000 kHz
Debug: 119 7 stlink_usb.c:3096 stlink_dump_speed_map(): 3300 kHz
Debug: 120 7 stlink_usb.c:3096 stlink_dump_speed_map(): 1000 kHz
Debug: 121 7 stlink_usb.c:3096 stlink_dump_speed_map(): 200 kHz
Debug: 122 7 stlink_usb.c:3096 stlink_dump_speed_map(): 50 kHz
Debug: 123 7 stlink_usb.c:3096 stlink_dump_speed_map(): 5 kHz
Debug: 124 37 stlink_usb.c:1086 stlink_usb_error_check(): 
STLINK_JTAG_GET_IDCODE_ERROR
Error: 125 37 stlink_usb.c:3748 stlink_open(): init mode failed (unable to 
connect to the target)
Debug: 126 37 stlink_usb.c:1659 stlink_usb_exit_mode(): MODE: 0x01
Debug: 127 37 command.c:544 run_command(): Command 'init' failed with error 
code -4
User : 128 37 command.c:608 command_run_line(): 
Debug: 129 37 target.c:2199 target_free_all_working_areas_restore(): freeing 
all working areas
~~~

The usb device is enumerated in dmesg :
~~~
[171481.193449] usb 1-4.2: New USB device found, idVendor=0483, idProduct=3753, 
bcdDevice= 1.00
[171481.193461] usb 1-4.2: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
[171481.193467] usb 1-4.2: Product: STLINK-V3
[171481.193471] usb 1-4.2: Manufacturer: STMicroelectronics
[171481.193475] usb 1-4.2: SerialNumber: 0019001C3656501420363341
[171481.198570] cdc_acm 1-4.2:1.1: ttyACM0: USB ACM device
[171481.199678] cdc_acm 1-4.2:1.4: ttyACM1: USB ACM device
~~~

Running stlink command `st-trace -v`:
~~~
Failed to parse flash type or unrecognized flash type
2022-12-07T09:08:55 DEBUG trace.c: show_help = false
2022-12-07T09:08:55 DEBUG trace.c: show_version = false
2022-12-07T09:08:55 DEBUG trace.c: logging_level = 100
2022-12-07T09:08:55 DEBUG trace.c: core_frequency = 0 Hz
2022-12-07T09:08:55 DEBUG trace.c: trace_frequency = 0 Hz
2022-12-07T09:08:55 DEBUG trace.c: reset_board = true
2022-12-07T09:08:55 DEBUG trace.c: force = false
2022-12-07T09:08:55 DEBUG trace.c: serial_number = any
2022-12-07T09:08:55 DEBUG common.c: *** looking up stlink version
2022-12-07T09:08:55 DEBUG common.c: st vid         = 0x0483 (expect 0x0483)
2022-12-07T09:08:55 DEBUG common.c: stlink pid     = 0x3753
2022-12-07T09:08:55 DEBUG common.c: stlink version = 0x3
2022-12-07T09:08:55 DEBUG common.c: jtag version   = 0xa
2022-12-07T09:08:55 DEBUG common.c: swim version   = 0x1
2022-12-07T09:08:55 DEBUG common.c: stlink current mode: mass
2022-12-07T09:08:55 DEBUG usb.c: JTAG/SWD freq set to 0
2022-12-07T09:08:55 DEBUG common.c: stlink current mode: mass
2022-12-07T09:08:55 DEBUG common.c: *** stlink_enter_swd_mode ***
2022-12-07T09:08:55 DEBUG usb.c: ENTER_SWD error (0x09)
Failed to enter SWD mode
2022-12-07T09:08:55 ERROR trace.c: Your stlink is not connected to a device
~~~

This seems to be somehow related to 
[#325](https://sourceforge.net/p/openocd/tickets/325/) 
[#308](https://sourceforge.net/p/openocd/tickets/308/) . 

Thank you for your help. 


---

Sent from sourceforge.net because openocd-devel@lists.sourceforge.net is 
subscribed to https://sourceforge.net/p/openocd/tickets/

To unsubscribe from further messages, a project admin can change settings at 
https://sourceforge.net/p/openocd/admin/tickets/options.  Or, if this is a 
mailing list, you can unsubscribe from the mailing list.


Reply via email to