You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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.
The text was updated successfully, but these errors were encountered:
pyOCD/pyocd/probe/jlink_probe.py
Line 254 in 5166025
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:
An equivalent of the above solution was tested in 0.35.1/0.36.0 and it seemed to resolve the issue.
The text was updated successfully, but these errors were encountered: