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

Feature request: full JTAG support #2

Open
xcvista opened this issue Sep 20, 2017 · 6 comments
Open

Feature request: full JTAG support #2

xcvista opened this issue Sep 20, 2017 · 6 comments

Comments

@xcvista
Copy link

xcvista commented Sep 20, 2017

There are some scenarios where it is necessary to us the full JTAG interface instead of the SWD interface to connect the DAP to the DUT, for example a JTAG daisy chain, a Cortex-A target like the Raspberry Pi, or when the older ARM7/ARM9/ARM11 chips gets involved. Is it possible to implement full JTAG on top of the current hardware and software?

JTAG uses a few existing SWD pins along with a few more:

  • JTMS / SWDIO (Existing pin, bidirectional in SWD, output in JTAG, with pull up)
  • JTCK / SWCLK (Existing pin, output with pull down)
  • JTDI (new pin, output with pull up)
  • JTDO / SWO (Existing pin, input with pull up)
  • nJTRST (new pin, output with pull up)
  • RTCK (new pin, input with pull down)

The RTCK pin worths some special mentioning: it is used on ARM7/ARM9/ARM11/Cortex-A chips to implement adaptive JTAG clocking. However this feature is entirely optional. You can just pull this pin down with a resistor and ignore it otherwise, if you have no plan on implementing JTAG adaptive clocking. There do exist some chips (like NXP LPC2103) that uses the pull down on RTCK to detect the presence of a debugger though.

@devanlai
Copy link
Owner

It's theoretically possible, though I'm not sure that the JTAG throughput will be satisfactory - the CMSIS-DAP commands for JTAG are very close to just passing bit-banging commands over USB HID, so the best-case performance would look similar to using a different adapter with a JTAG clock rate of 256KHz.

If you want to try it out yourself, here are the steps to do it:
On the hardware side, there are two unused pins (PF0 and PF1) which you can use for JTDI and nJTRST.
For RTCK, if you wanted to do adaptive clocking, it would be necessary to multiplex or repurpose one of the existing pins. Some possible candidates:

  • PA13/PA14 - if you're not interested in debugging the debugger, you could use the debugger's SWDIO or SWCLK pin for RTCK.
  • PB8 - if you set the option byte to disable the BOOT0 function, then you can use PB8 for anything.
  • PA0/PA1/PA4 - you could drop one of the LEDs

In software, the source still includes a copy of the reference CMSIS-DAP JTAG bit-banging code, so enabling it is really just a matter of changing some defines and hooking up the relevant JTAG pin definitions.

@xcvista
Copy link
Author

xcvista commented Sep 21, 2017

I think that PB8 can be used for RTCK without dealing with the option bytes, since it is pulled down by default as BOOT0 should be when powered up.

@devanlai
Copy link
Owner

That seems reasonable, since RTCK should only ever be a delayed copy of JTCK.

@xcvista
Copy link
Author

xcvista commented Oct 28, 2017

I am in the process of building one based on this hardware idea, although some changes are made:

  • RTCK not connected to the microcontroller,
  • USB Interface changed to HID + CDC for CMSIS-DAP + USB Serial combo.
  • SWO support deleted (freeing up resources for the CDC)
  • External crystal (faster boot time)
  • LEDs reduced to two.

@xcvista xcvista closed this as completed Oct 28, 2017
@xcvista xcvista reopened this Oct 28, 2017
@ildar
Copy link

ildar commented Nov 18, 2019

@xcvista , did you build a working prototype? (HW + FW)
what's your target chip? (I'm still looking for JTAG FW for my BluePill)

@xcvista
Copy link
Author

xcvista commented Nov 20, 2019

@ildar I have several versions of hardware but I have little time for the software now.

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