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

Invalid error code: -11 from rtt_read() #160

Open
multiplemonomials opened this issue Jan 19, 2023 · 2 comments
Open

Invalid error code: -11 from rtt_read() #160

multiplemonomials opened this issue Jan 19, 2023 · 2 comments

Comments

@multiplemonomials
Copy link

Hi, I've been using pylink on a couple boards and it's been working pretty well so far! However, today one of my boards got in a bad state where RTT can't be used with it. My code has:

jlink.rtt_read(0, 1024)

and the stacktrace I get is:

  File "/home/jsmith/.local/lib/python3.10/site-packages/pylink/jlink.py", line 142, in wrapper
    return func(self, *args, **kwargs)
  File "/home/jsmith/.local/lib/python3.10/site-packages/pylink/jlink.py", line 5111, in rtt_read
    raise errors.JLinkRTTException(bytes_read)
  File "/home/jsmith/.local/lib/python3.10/site-packages/pylink/errors.py", line 38, in __init__
    message = self.to_string(code)
  File "/home/jsmith/.local/lib/python3.10/site-packages/pylink/enums.py", line 264, in to_string
    return super(JLinkRTTErrors, cls).to_string(error_code)
  File "/home/jsmith/.local/lib/python3.10/site-packages/pylink/enums.py", line 96, in to_string
    raise ValueError('Invalid error code: %d' % error_code)
ValueError: Invalid error code: -11

It looks like the J-Link DLL is returning error code -11 but this library doesn't know how to interpret that? btw, it's worked fine with this same board and script in the past.

@hkpeprah
Copy link
Contributor

Sorry, I do not know what that error code is. The logs are usually a better descriptor, so if you don't have logging enabled, then I would enable it:

import logging

logging.basicConfig(level=logging.DEBUG)

@vincentdman
Copy link

Hey i have the same problem.
It seems to be a usage error. i can reproduce it by attaching a jlink to my mcu.
have the rtt_read() running in a thread.
then connect with the wrong device selected using jlink.connect.
then connect with the right device and program that device (i used a script for programming called by subprocess).
It gives the same exception traceback.
So i fixed it by first disconnecting before connecting to a new device.
I hope this helps someone

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

3 participants