stlink icon indicating copy to clipboard operation
stlink copied to clipboard

Detecting when the ST-Link or Target was disconnected

Open gustavolaureano opened this issue 3 years ago • 3 comments

Hi,

Is there a way to detect, after opening the ST-Link, when the target or the ST-Link was disconnected?

I am coding an application that requires periodic polling of the target's RAM, but also requires to detect when the target or the ST-Link was disconnected (or not yet connected) and reconnect (in hotplug) as soon as it finds the target / stlink again.

During some tests on Linux I could not get any error from stlink_read_mem32() or even stlink_status() when removing the target on the fly.. my solution was to always close and open the stlink when starting the next reading, which works without problems on Linux, but keeps giving me random "denied access" errors on Windows, something related to the libusb.

Thanks!

Gustavo

gustavolaureano avatar Jun 06 '21 11:06 gustavolaureano

@gustavolaureano, Hi!

I improved the command status check. You can try: https://github.com/Ant-ON/stlink/commits/connect_under_reset_rework

Ant-ON avatar Jun 06 '21 17:06 Ant-ON

@gustavolaureano Have you had the chance to try in the meanwhile?

Nightwalker-87 avatar Jun 16 '21 07:06 Nightwalker-87

@gustavolaureano Have you had the chance to try in the meanwhile?

Hi, unfortunately not yet, I will return to this project in the coming weeks, then I report back here :)

gustavolaureano avatar Jun 20 '21 15:06 gustavolaureano

@Ant-ON: Can you contribute your improvements in order to close this issue?

Nightwalker-87 avatar Aug 27 '22 10:08 Nightwalker-87

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.

Nightwalker-87 avatar Oct 23 '22 17:10 Nightwalker-87