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

[opentitantool] Allow changing which pins to use for JTAG #20934

Merged
merged 1 commit into from
May 31, 2024

Conversation

jesultra
Copy link
Contributor

@jesultra jesultra commented Jan 23, 2024

HyperDebug by default does JTAG on five particular pins. However, as it is all bit-banging with no true hardware support, it is able to use almost any combination of pins.

This PR introduces a transport-specific command to "move" the JTAG functionality to a different set of pins.

Usage:
opentitantool --interface=hyperdebug transport set-jtag-pins <TCLK> <TMS> <TDI> <TDO> <TRSTn>

HyperDebug by default does JTAG on five particular pins.  However, as it
is all bit-banging with no true hardware support, it is able to use
almost any combination of pins.

This PR introduces a transport-specific command to "move" the JTAG
functionality to a different set of pins.

Usage:
`opentitantool --interface=hyperdebug transport set-jtag-pins <TCLK> <TMS> <TDI> <TDO> <TRSTn>`

Signed-off-by: Jes B. Klinke <[email protected]>

Change-Id: Ibf61be39949b6330f4dd1ec01c44bbdc5cc2350c
@jesultra jesultra requested review from cfrantz and engdoreis January 23, 2024 19:37
@jesultra jesultra marked this pull request as ready for review January 24, 2024 19:53
@jesultra jesultra requested a review from a team as a code owner January 24, 2024 19:53
@BenBenderOT
Copy link

Thanks Jes. We are still testing this.

Copy link
Contributor

@pamaury pamaury left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Is proxy support necessary?

@BenBenderOT
Copy link

The code looks good. Maybe keep the PR open until we've validated it works?

@jesultra
Copy link
Contributor Author

Looks good to me. Is proxy support necessary?

Maybe at some point. For now, proxy support is not implemented for any JTAG functionality.

The code looks good. Maybe keep the PR open until we've validated it works?

Yes, I will wait for you Ben, to try this out on real hardware, before merging.

@jesultra jesultra changed the title [opentitantool] Allow changing of JTAG pins [opentitantool] Allow changing which pins to use for JTAG Feb 5, 2024
@jesultra jesultra added SW:opentitantool CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival labels Feb 6, 2024
@jesultra
Copy link
Contributor Author

jesultra commented Feb 6, 2024

@BenBenderOT have you had a chance to try this out on actual hardware?

@BenBenderOT
Copy link

@jesultra we tried setting to pins we needed. Still unable to confirm it worked. Hopefully today or tomorrow.

@BenBenderOT
Copy link

I'm using the "hyper310" interface instead of the "hyperdebug" interface. Should that make a difference? In any case, as soon as I try to set the pins to their default settings using the command, no signals are seen anymore and examination fails.

@jesultra
Copy link
Contributor Author

jesultra commented Feb 8, 2024

I'm using the "hyper310" interface instead of the "hyperdebug" interface. Should that make a difference? In any case, as soon as I try to set the pins to their default settings using the command, no signals are seen anymore and examination fails.

That was unexpected. It should not matter that you use --interface=hyper310, the JTAG support is identical between that and --interface=hyperdebug.

It is hard for me to understand, how setting JTAG pins to their default setting would cause JTAG to stop working. Looking at the HyperDebug firmware code, I see a bug that can be triggered if you first do some JTAG communication, then switches JTAG pins, and then tries JTAG communication again. Could you try hitting the black reset button on your HyperDebug board, and then seeing if OpenOCD can connect? Assuming that works, then please reset again, then set the pins to their default value, and then see if OpenOCD can connect. Also, could you post the exact command you use to the pins to their default? This one should do it, but using aliases of the given pins should result in the same:

opentitantool --interface=hyperdebug transport set-jtag-pins CN7_1 CN7_7 CN7_3 CN7_5 CN7_16

@jesultra
Copy link
Contributor Author

This feature did not work due to a silly bug in the HyperDebug firmware. With the below fix, I have observed JTAG on my CW310 work with some jumper wires to non-standard pins on HyperDebug. In plan on merging this, once the updated firmware has been included in opentitantool.
https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/5568495

@jesultra jesultra merged commit ddf7674 into lowRISC:master May 31, 2024
34 checks passed
Copy link

Successfully created backport PR for earlgrey_es_sival:

@jesultra jesultra deleted the jtag branch May 31, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPick:earlgrey_es_sival This PR should be cherry-picked to earlgrey_es_sival SW:opentitantool
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants