Skip to content

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

Description

@v-clone

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.

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