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

Attempting to connect to jlink with a JTAG frequency specified in 'options' does not honor the specified frequency, subsequently resulting in inability to connect to targets with limited JTAG frequency #1745

Open
v-clone opened this issue Nov 29, 2024 · 0 comments

Comments

@v-clone
Copy link

v-clone commented Nov 29, 2024

self._link.connect(device_name)

In jlink_probe.JLinkProbe.connect(), there is a line that calls jlink.JLink.connect():

`
self._link.connect(device_name)

`
The caller only passes the device name to the callee, leaving the remaining two arguments to default to speed = 'auto' and verbose = False. This even if the application requests a specific JTAG frequency through the 'frequency' option. This causes the driver to attempt JTAG speed auto-detection, despite the fact that the application wants to use a specific frequency.

The problem with this is that, when speed = 'auto', the driver seems to start the auto-detection process with the setting of 4MHz. When that fails, it drops to 2MHz. When that fails, it seems that the driver gives up, eventually resulting in an exception. As a result, any use-case where the driver's internal auto-detect algorithm fails for whatever reason, it is impossible to establish a working connection, even if a known working frequency has been specified by the application.

Looking at other code in the caller, a possible fix could look something like this:

...
if device_name is not None:
    # If speed specified through options...
    if self.session.options.get('frequency') != None:
        # ... use the speed from options:
        speed = self.session.options.get('frequency')
    else:
        # otherwise, fall back to auto-detect:
        speed = 'auto'
    self._link.connect(device_name, speed=speed)
...

An equivalent of the above solution was tested in 0.35.1/0.36.0 and it seemed to resolve the issue.

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