Jump to content
  • 0

Serial Wire Debug(SWD) and JTAG analyzer


yogeshL

Question

I am a new user and just started to use the digital discovery. I want to analyze SWD and JTAG protocols for a project– currently these protocols are not supported in Waveform, is there any plans to support it in the future? This would be really helpful. Thank you!

Link to comment
Share on other sites

Recommended Posts

  • 0

Hello Attila,

I have captured the initialization process in Digilent and have attached the project file below. The initialization sequence is up till IDCode pattern request. Please see if there is any missing pattern between the first 50 bit line reset sequence and IDcode pattern request which is to be added in the form of javascript commands. In our JS scripts we have only given 50 but line reset sequence and ID code request. In between the two there is some sequence which we have missed in our commands. 

Thanks,

Shalin

connection_line_sequence_Digilent.dwf3logic

Link to comment
Share on other sites

  • 0

Hi @Shalin

I don't know what that initialization is but you could send this sequence using SPI and continue with SWD.

EDIT: Attaching the workspace: spiswd.dwf3work

image.png

Protocol.Mode.text = "SPI";
Protocol.SPI.Write(8, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x79, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6D, 0xB7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00]);
Protocol.Mode.text = "SWD";
Protocol.SWD.Read(0,0)
//...

 

Link to comment
Share on other sites

  • 0

Hi @Shalin

Is it working ?
Isn't suffice to have a longer reset, like 58 or more ?

With NUC140VE3CN I see a similar but not identical initialization sequence. This target responds after a normal reset command, the initialization sequence is not needed.
Please let me know if you figure out what this is.

image.pngimage.png

Link to comment
Share on other sites

  • 0
18 hours ago, attila said:

Hi @Shalin

Is it working ?
Isn't suffice to have a longer reset, like 58 or more ?

With NUC140VE3CN I see a similar but not identical initialization sequence. This target responds after a normal reset command, the initialization sequence is not needed.
Please let me know if you figure out what this is.

image.pngimage.png

Hello Attila, 

Sorry, I had got a bit tied up yesterday. I tried today with 58 bits and also took higher number of bit line reset sequence. However, the target is not responding. The output is still 0. I am trying other ways in case if we are missing some command because when I connect the Segger Ultra+ debug probe, the target responds immediately when I give "connect" command through the J-link commander. 

In my project, I want to eliminate the use of J-link debugger probe for initial connect and use Digilent throughout. Currently, I need to use Segger for initial connect and then I need to remove Segger and then connect Digilent for subsequent read/write patterns.

Thanks,

Shalin

Link to comment
Share on other sites

  • 0

Hi @Shalin

Have you tried this ?

On 3/28/2023 at 6:34 PM, attila said:

Hi @Shalin

I don't know what that initialization is but you could send this sequence using SPI and continue with SWD.

EDIT: Attaching the workspace: spiswd.dwf3work

image.png

Protocol.Mode.text = "SPI";
Protocol.SPI.Write(8, [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x79, 0xE7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x6D, 0xB7, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00]);
Protocol.Mode.text = "SWD";
Protocol.SWD.Read(0,0)
//...

 

 

Link to comment
Share on other sites

  • 0

Hello Attila,

I tried just now. By using this I am getting the correct ID code in the protocol window. However some write commands are failing. I am attaching the screenshots of prtotocol and script window below. Also I am attaching the workspace of mine. Also, when I debug each command, in SWD reset sequence I see around 156 bit line reset sequence in logic window whereas I had set 52 bits in protocol window. In addition, I am getting wrong ID code in logic window. 

Thanks,
Shalin

image.thumb.png.d57ce0cdf51881ab481bcefd14b581f3.png

image.png.3497499aedaf5e1db02c8c39d269198a.png

image.png.56af6d02d1458ca05eefb0e158968a55.png

image.png.56f4bcfe21d728bf91383c031d1176f3.png

image.png.e9a2589c715ee36c0a68c42605fa2b1f.png

spiswd.dwf3work

Link to comment
Share on other sites

  • 0

Hi @Shalin

I don't know why are you getting only FFs during the SPI part. If this works with your target probably a longer rest would be also suffice.

Fault is a valid response prom the protocol perspective.
Compared to your earlier capture:
- that uses 100kHz and not 1MHz
- uses different command order, after the abort register (DP A0) write the ctrl/stat (DP A1) is written not A2, see the last 2 pics

image.png

image.png

 

image.png

image.png

Link to comment
Share on other sites

  • 0

Hello Attila,

Thank you so much for pointing the issue. I was missing the CTRL/STAT register. Its pulling up completely through Digilent now. I am very happy and satisfied that I can control my project through Digilent Digital discovery completely. It’s all your efforts which has made this possible today. 
Now, I am looking forward to control Digilent pattern generation through LabView. I will use the latest version of Digilent which provides support for inbuilt SWD functions to control Digilent pattern generation. I will keep you posted about the same.

Thanks,

Shalin

Edited by Shalin
Link to comment
Share on other sites

  • 0
On 3/24/2023 at 5:18 PM, attila said:

Hi @JAlaj

SWD SDK/API functions are available in the latest version:

 

Hello Attila,

I was in process of importing the SWD functions in labview. However, error is popping up in the function window against the developed SWD functions. I am attaching a screenshot below. It is asking to check the header file.

Thanks,

Shalin

 

image.png.076e95d116681cd6f08644d0a3355466.png

Link to comment
Share on other sites

  • 0

Hello Attila,

I was working on SWD read VI function ("FDwfDigitalSwdRead ()")   driver in labview. The output data (hAE8091DC) appearing in labview for read ID code does not match with the correct output data (h6BA02477) from the waveforms GUI . However, the pattern obtained from both labview and waveforms GUI appear the same for read ID code. I am attaching both the patterns alongwith the screenshot of labview block diagram/front panel window below. 

According to me, there is some issue in the data interpretation by the "pRead out" parameter of SWD read function "FDwfDigitalSwdRead ()" of labview.

Thanks,
Shalin

 

read ID code Labview pattern.JPG

Waveforms GUI labview pattern.png

SWD front panel window.JPG

SWD Block diagram window.JPG

Edited by Shalin
Link to comment
Share on other sites

  • 0

Hi @Shalin

Edit: I've removed the latest beta version post since it has a crash bug in the Scope when used with only one device.
Here you have the link for this installer which includes the swd clear fix:
https://digilent.s3.us-west-2.amazonaws.com/Software/Waveforms3Beta/3.19.33/digilent.waveforms_beta_v3.19.33_64bit.exe

First you should call the SWD clear function (to reset) then the others... read...

image.png

image.png

Link to comment
Share on other sites

  • 0

Hello Attila,

I have added the SWD clear function and reinstalled the Waveform beta which includes the updated SDK. Now, I am getting the correct output in LabView when I read a address.
Thank you so much for solving the issue in such a short time span.

Shalin

Link to comment
Share on other sites

  • 0

Hello @attila

There are errors occurring in the labview VI functions after updating to the new waveform SDK version 3.20.31. I am attaching the screenshot of the block diagram window of the labview from where you can see the error in some of the SWD API functions. 

Thanks,

Shalin

image.thumb.png.b9e416d85982cbe179d1ef522fb5724e.png

Edited by Shalin
The issue is resolved
Link to comment
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
×
×
  • Create New...