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

Command failure on certain versions #26

Open
schneidersoft opened this issue Mar 19, 2023 · 0 comments
Open

Command failure on certain versions #26

schneidersoft opened this issue Mar 19, 2023 · 0 comments

Comments

@schneidersoft
Copy link
Contributor

I have noticed that some stlinkv2 versions do not work as expected
I use the following python code:

import swd

dev = swd.Swd()
print(dev.get_version().str)
print(dev.get_target_voltage())
print(dev.get_idcode())

cm = swd.CortexM(dev)

cm.halt()
cm.reset()
cm.run()

print(cm.get_reg('PC'))

And get the following output:

$ python3 swdtest.py 
ST-Link/V2 V2J38S7
3.23
463475831
Traceback (most recent call last):
  File "swdtest.py", line 14, in <module>
    print(cm.get_reg('PC'))
  File "/usr/local/lib/python3.8/dist-packages/swd/cortexm.py", line 61, in get_reg
    return self._swd.get_reg(CortexM._get_reg_index(reg))
  File "/usr/local/lib/python3.8/dist-packages/swd/swd.py", line 58, in get_reg
    return self._drv.get_reg(register)
  File "/usr/local/lib/python3.8/dist-packages/swd/stlink/__init__.py", line 251, in get_reg
    _check_status(status)
  File "/usr/local/lib/python3.8/dist-packages/swd/stlink/__init__.py", line 56, in _check_status
    raise StlinkException(_com.StlinkCom.STATUS.MESSAGES[status])
swd.stlink.StlinkException: Command error

With a different stlinkv2

$ python3 swdtest.py 
ST-Link/V2 V2J33S7
3.23
463475831
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant