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

Fix: adiv5/6 JTAG version handling #2054

Merged
merged 3 commits into from
Jan 15, 2025
Merged

Conversation

dragonmux
Copy link
Member

Detailed description

This PR addresses a mistake made in the way that we handle DP versioning for JTAG-DPs in ADIv5 and v6.

ADIv5 implements protocol version 0, while ADIv6 implements version 1. This is a totaly different thing to the detectable version from the JTAG IDCODE PARTNO field which is related to the DP version instead.

We correct the low-level handling in adiv5_jtag.c with this, so that DPv0-2 work properly as protocol v0, while DPv3+ are protocol v1. This allows the PARTNO -> version translation to then be corrected and handled more appropriately.

Tested on a LPC4370.

Your checklist for this pull request

Closing issues

@ALTracer
Copy link
Contributor

Tested on GD32E508.

Can confirm, this is as good or better than before, on this chip.
Before PR2053 (fails):

Black Magic Debug App v2.0.0-rc1-17-g6585197c
...
ID code 0x0ba04477: ADIv5 JTAG-DP port.
ID code 0x790007a3: Gigadevice BSD.
Unknown JTAG-DP found, please report partno code ba04
Not using ADIv5 acceleration commands
DP DPIDR 0x0be11477 (v1 MINDP rev0) designer 0x43b partno 0xbe
> JTAG access resulted in fault
...
> JTAG access resulted in fault
adiv5: power-up failed
Given target number 1 not available max 0

With PR2053: (DPv0)

Black Magic Debug App v2.0.0-rc1-18-gcff3b4e6
...
ID code 0x0ba04477: ADIv5 JTAG-DP port.
ID code 0x790007a3: Gigadevice BSD.
DPv0 detected based on JTAG IDCode
AP   0: IDR=14770015 CFG=00000000 BASE=e00fe000 CSW=a3800040 (AHB5-AP var1 rev1)

With this PR2054: (DPv1, MINDP, has DPIDR, uses ABORT not CTRL/STAT)

Black Magic Debug App v2.0.0-rc1-21-g868b41d8
ID code 0x0ba04477: ADIv5 JTAG-DP port.
ID code 0x790007a3: Gigadevice BSD.
DP DPIDR 0x0be11477 (v1 MINDP rev0) designer 0x43b partno 0xbe
AP   0: IDR=14770015 CFG=00000000 BASE=e00fe000 CSW=a3800040 (AHB5-AP var1 rev1)

Firmware produces identical logging on blackpill-f4.

Thanks for restoring operation.

@dragonmux dragonmux added this to the v2.0 release milestone Jan 15, 2025
@dragonmux dragonmux added Bug Confirmed bug Regression Bug caused by a regression labels Jan 15, 2025
@dragonmux dragonmux requested a review from esden January 15, 2025 10:53
@dragonmux dragonmux force-pushed the fix/adiv5-v6-jtag-version-handling branch from 868b41d to d643492 Compare January 15, 2025 14:07
Copy link
Member

@esden esden left a comment

Choose a reason for hiding this comment

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

LGTM

@esden esden merged commit d643492 into main Jan 15, 2025
36 checks passed
@dragonmux dragonmux deleted the fix/adiv5-v6-jtag-version-handling branch January 15, 2025 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug Regression Bug caused by a regression
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants