pavelrevak / pystlink

Python tool for flashing and debugging STM32 devices using ST-LINK/V2
MIT License
218 stars 59 forks source link

Detecting disconnect between ST-Link and target #19

Closed jimfred closed 4 years ago

jimfred commented 4 years ago

I'm looking for a way to determine if the link between the ST-Link and the target is broken. So far, the only way I've found is to update the target_voltage reading. I expected coreid to update if the link was unplugged but instead it seems to report a cached value. I want to do this to automate firmware downloads in a test fixture so that if a new target board was plugged in, a firmware download would automatically begin, similar to the auto-download capability of the ST-Link utility. I'm using Windows.

jimfred commented 4 years ago

I needed to call Stlink.read_coreid() and then read Stlink.coreid. It is zero when the ST-Link is unplugged from the target.