Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCU hotplug - stlink doesn't recover the STLINKV2 from error state. #888

Closed
rewolff opened this issue Mar 21, 2020 · 11 comments
Closed

MCU hotplug - stlink doesn't recover the STLINKV2 from error state. #888

rewolff opened this issue Mar 21, 2020 · 11 comments

Comments

@rewolff
Copy link
Contributor

rewolff commented Mar 21, 2020

When hotplugging CPUs or boards, the STLINK often goes into "error" state. Not sure if it CAN be recovered, but if possible, resetting the error state would be nice. :-)

@rewolff
Copy link
Contributor Author

rewolff commented Mar 21, 2020

I currently know of only one way to clear the error state: unplug and replug the STLINK.

The cause for the "errorstate" is, I suspect, that the decoupling caps in the target pull the 3.3V on the stlink low enough that the STLINk crashes. So maybe there is nothing to recover.

@rewolff
Copy link
Contributor Author

rewolff commented Mar 21, 2020

Old version: (aborts as expected).

assurancetourix:~> st-util -m
libusb_handle_events() | has_error
[!] send_recv
libusb_handle_events() | has_error
[!] send_recv
libusb_handle_events() | has_error
[!] send_recv
libusb_handle_events() | has_error
[!] send_recv
2020-03-21T17:17:03 INFO src/stlink-common.c: Loading device parameters....
libusb_handle_events() | has_error
[!] send_recv
libusb_handle_events() | has_error
[!] send_recv
libusb_handle_events() | has_error
[!] send_recv
2020-03-21T17:17:03 WARN src/stlink-common.c: unknown chip id! 0
assurancetourix:~> 

Recent version that does not abort.

assurancetourix:~> ~/stm32/stlink.git2/build/Release/src/gdbserver/st-util -m
st-util 1.6.0-33-gb8813fa-dirty
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_GET_VERSION
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_GET_CURRENT_MODE
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_GET_CURRENT_MODE
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_DEBUG_ENTER
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_JTAG_DRIVE_NRST
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_DEBUG_RESETSYS
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_DEBUG_READCOREID
2020-03-21T17:12:32 ERROR common.c: Failed to read core_id
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_JTAG_READDEBUG_32BIT
2020-03-21T17:12:32 WARN common.c: Invalid flash type, please check device declaration
[!] send_recv send request failed: LIBUSB_ERROR_IO
[!] send_recv STLINK_DEBUG_RESETSYS
2020-03-21T17:12:32 INFO gdb-server.c: Listening at *:4242...


@Nightwalker-87
Copy link
Member

Not very nice indeed... Thx for putting this up. 👍

@Nightwalker-87 Nightwalker-87 added the programmer/STLINK/V2 V2 / V2-A / V2-B label Mar 21, 2020
@Nightwalker-87 Nightwalker-87 changed the title stlink doesn't recover the STLINKV2 from error state. [feature] MCU hotplug - stlink doesn't recover the STLINKV2 from error state. Mar 27, 2020
@Nightwalker-87
Copy link
Member

Related to #449 and #244.

@chenguokai
Copy link
Collaborator

I guess, this problem may be restored to the expected aborts behaviour by applying the same method used in #913
What might be challenging is to reproduce this error with host debugger on st-util and find out what kinds of error need to be treated as critical.

@Nightwalker-87
Copy link
Member

@rewolff: Are you working on this?

@rewolff
Copy link
Contributor Author

rewolff commented Apr 17, 2020

Sorry.... Paid work takes precedence....

Should I find some free time...
Does github make it easy for me to vew the issues you've tagged me on?

@Nightwalker-87
Copy link
Member

Thats ok. I just wanted to know if there was any further activity planned here.
To me assigning topics just helps to stay on track who is involved with which topic.
So I may ask every once in a while to stay up to date and to maintain an overview.

Yes, you can add the author:rewolff tag when searching open issues or select yourself in the "Author" dropdown menu in the issue header bar (which leads to the same result).

@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.1, v1.6.2 Apr 28, 2020
@Nightwalker-87 Nightwalker-87 modified the milestones: v1.6.2, v1.6.3 Mar 10, 2021
@Nightwalker-87
Copy link
Member

@Ant-ON This may also be addressed in your recent PR.

@Ant-ON
Copy link
Collaborator

Ant-ON commented Apr 12, 2021

@Nightwalker-87 Not, it's not related. To solve this issue, needs to catch LIBUSB_ERROR_IO errors and calls libusb_reset_device

@Nightwalker-87 Nightwalker-87 changed the title [feature] MCU hotplug - stlink doesn't recover the STLINKV2 from error state. MCU hotplug - stlink doesn't recover the STLINKV2 from error state. Aug 15, 2021
@Nightwalker-87
Copy link
Member

This issue is now closed due to inactivity.
Please also note that any version prior to v1.7.0 is unsupported according to our #Security Policy.
Should the problem persist, please retry with the latest version in the develop branch.
If this is the case, one should then open a new ticket.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants