• 0
Jim H

2 wire JTAG

Question

I am using the Digilent HS-2 cable to communicate with an ARM core in 2W mode (ARM's SWD - single wire debug mode).

The signals available are CLK and TMS.  Sending doesn't look to be a problem, but when I read data from the ARM, it is sent out on TMS.

How do I read the state of the TMS pin?  The Diglent DLL has an API"DjtgPutTmsBits", but nothing to get the state of TMS.

Any ideas?

 

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Hi @Jim H,

Have you look at the DjtgTwoWireDemo.cpp and the DjtgTwoWireDemoReadme text file in the samples folder found here: digilent.adept.sdk_v2.4.2\samples\djtg\DjtgTwoWireDemo? 

thank you,

Jon

Share this post


Link to post
Share on other sites
  • 0

Yes, I have seen the Two Wire Demo... but for our application the device is not in a standard 2-wire mode (OScan, for example).

We are accessing the ARM core in SWD (single wire debug) mode, using just TCK and TMS.  The protocol is similar to a serial SPI transaction.

For example, a read requires TMS to drive out 8 bits of opcode, then 1 bit TAR, then 3 bits of returned ACK, followed by a 32-bit read.

I can use DjtgPutTmsBits to drive the first 8 bits, but I have no way of reading the state of TMS for the remaining bits...

Using DjtgGetTmsTdiTdoTck will return the current state of the pins, including TMS, but I need a way to send clocks and read TMS...

I have thought of using the Dspi functions, but they TMS as the CS so that is not a solution.

Share this post


Link to post
Share on other sites
  • 0

Hi @Jim H,

I reached out to one of our design engineer about this forum and they responded that they are not familiar with 2-wire ARM debugging/programming. Is it an SPI interface? The labeling suggests that it’s a two-wire JTAG interface. If it follows the 1149.7 standard then you can use the DJTG library. You will have to use the set scan format function to set it up for the appropriate 2-wire mode. 

They also believe that you will need to configure the tap controller to some degree so that it’s using the desired scan format. It’s been so long since they did this and they don’t remember all of the details. Anyone wanting to write their own application that interfaces with a two-wire JTAG tap is definitely going to need to review the 1149.7 specification. 

thank you,

Jon

Share this post


Link to post
Share on other sites
  • 0

The closest match to the ARM SWD protocol is the JScan0-JScan3 in 2-Wire STAR topology mode, as referred to in the DJTG Programmer's Reference Manual (Doc 506-019), on page 16 and 17.  The 2-Wire Star Topology diagram shows the TMSC pin as an output AND input.... but I see no API that allows the TMS stream to be captured and read...

Can anyone comment on this?

 

Thanks.

 

Share this post


Link to post
Share on other sites
  • 0

Hi @Jim H

The TMSC pin is only bi-directional when using the MScan, OScan0, OScan1, OScan2, OScan4, OScan5, or OScan6 scan formats. Data is only read from the TMSC pin during the bit times denoted "TDO" in those scan formats. The DjtgSetScanFormat function must be called to set the scan format. Further, if you are using a scan format (OScan2 - OScan 7) that requires a different packet format during shift-XR vs non-shift-XR states then you must call DjtgSetScanFormat and tell it each time you've navigated into or out of the shift-xr state of the TAP controller so that it uses the correct packet formatting.

Based on your description of the ARM SWD protocol it doesn't sound like it's going to be possible to implement it using a JTAG-HS2... at least not with any of our existing software API's, and certainly not with the DJTG API. I think the hardware itself may be capable of implementing the protocol, but without digging deeper into ARM SWD protocol I'm not sure.

Thanks,
Michael

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now