Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

cJTAG support #27

Open
thvdveld opened this issue Feb 23, 2021 · 7 comments
Open

cJTAG support #27

thvdveld opened this issue Feb 23, 2021 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@thvdveld
Copy link

Hi! I was wondering how I could add cJTAG support to the project such that I can use with rust embedded toolchain.
Not sure if this is the place to ask this, but could you point me out in the correct direction such that I can help implement it?
I will gladly create a PR then!

@jonas-schievink
Copy link
Owner

Hi! Check out the wip branch, it should in theory allow you to switch to cJTAG mode and then use jtag_io with it. I haven't tested it though, because I don't have any MCU that speaks cJTAG.

@thvdveld
Copy link
Author

Thanks for the quick response!

Ah yes, I didn't looked into wip.
I copied the PIC32 example to test if cJTAG works, however, I don't know anything about JTAG.
Is there any jtag_io sequence that could tell if cJTAG works?

I'm using a CC2538 and sections 5.2.1 and 5.2.2 talk about JTAG commands etc., but this is gibberish for me.

@jonas-schievink
Copy link
Owner

I know fairly little about cJTAG unfortunately. What happens if you run the jtag_scan example but with the cJTAG transport? Do you get an error or does it result in a valid scan chain already?

@thvdveld
Copy link
Author

I get the following:

Checking for cJTAG connection...
error: could not detect closed JTAG chain (check connection, or consider increasing the max chain length)

@jonas-schievink
Copy link
Owner

Hmm, of course it's not that simple... The next step would be to look at the USB packets in wireshark between jaylink and the official tooling (or libjaylink, if that supports cJTAG), and possibly also hook up a logic analyzer to look at the signals. In any case, you'll have to get some "known-good" cJTAG setup with another tool, and then we can try to match what it does here.

@thvdveld
Copy link
Author

Thanks for the pointer with wireshark! I will have a look at that today and will let you know how it goes!

@jonas-schievink jonas-schievink added the help wanted Extra attention is needed label May 26, 2021
@thvdveld
Copy link
Author

thvdveld commented Jun 3, 2021

It's been a long time, but I tried debugging it further.
I tried connecting with JLinkExe to the CC2538 (which uses cJTAG) using the cJTAG protocol and even the official tool of Segger does not seem to be able to communicate with it.
I also have an XDS110 debugger which is able to connect using cJTAG, so I think it is a Segger related problem and not this library.

As a side note, when using JLinkExe, with the JTAG protocol, it manages to create a connection.
It does that by using a sequence that tells the CC2538 to use JTAG instead of cJTAG.
I found this sequence in OpenOCD.
After the sequence, the JLink uses regular JTAG.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants