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

How to close JTAG reference properly #2

Open
boortel opened this issue Apr 20, 2021 · 3 comments
Open

How to close JTAG reference properly #2

boortel opened this issue Apr 20, 2021 · 3 comments

Comments

@boortel
Copy link

boortel commented Apr 20, 2021

Hello again,

I continue with the experiments and I'm not able to find, how to close the JTAG reference properly. This cause troubles in finding probes, when I restart the processor, or when I try to run the script again.

The dummy code, which leads to error by its re-running, is following:

from jtagbs import JTAGCore, JTAGBS
import time

# Initialize
interface = JTAGCore()
jtag = JTAGBS(interface)

# Get list of probes
probes = jtag.list_available_probes()
probesVal = ([(k) for k in probes])

print("Probes values are:")
print(probesVal)

# Open the selected probe and get Device ID
jtag.open_probe(probesVal[0])
jtag.init_scanchain()

print("Device ID:")
print(jtag.list_devids())
print("Device information:")
print(jtag.list_devices())

# Load the BSD file - better use the absolute path - relative does not work time to time
stm32 = jtag.get_device(0)
stm32.set_bsdl(r'BSDL/TMS320F2803X_TQFP.bsdl')
#stm32.set_bsdl(os.path.join(dirname, 'BSDL/TMS320F2803X_TQFP.bsdl'))

print(stm32.list_pins())

stm32.set_scan_mode("active")

stm32.set_pin_state("GPIO34", True)
print(stm32.get_pin_state("GPIO34"))

The following error occurs when running the script again:

Probes values are:
[]
Traceback (most recent call last):

  File "C:\Users\user\JTAGBS_FirstTry.py", line 25, in <module>
    jtag.open_probe(probesVal[0])

IndexError: list index out of range

Everything works properly while the first run and I can fix the re-run problem with the kernel restart. However, I need to re-run my script and BS for several times and the restart solution is not suitable for me. It would be nice to close everything and then to initialize the references again. Could you please help me with this issue?

Thanks in advance!

Sims

@colinoflynn
Copy link
Owner

What probe are you using & OS? I'll try here - to be honest I've just been rerunning it without noticing a problem. The underlying library doesn't have a "close" function which suggests we don't either.

You might be able to delete the object (at least the ctypes interface) which could close it?

@boortel
Copy link
Author

boortel commented Apr 26, 2021

I use the Texas Instruments XDS100+RS232 V1.0 A TI16QHTYA probe and Win10 OS.

The problem occurs only, when I rerun the initialization part - the next run returns only empty probes. Removing the interface and jtag variables doesn't help - I always have to restart the whole kernel.

@Oremuss
Copy link

Oremuss commented Mar 5, 2023

I have same problem and its also with XDS100. @boortel did you find solution or you just made workaround with resetting kernel?

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