Skip to content

Command failure on certain versions #26

Open
@schneidersoft

Description

@schneidersoft

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions