Author Topic: Is there any chip solution available to do SWD <---> JTAG conversion?  (Read 3796 times)

0 Members and 1 Guest are viewing this topic.

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Hello All,

I am looking for a chip that can do SWD <---> JTAG conversion. Is there any chip solution available for this?.If anyone have come across this, please suggest.


Thanks and Regards,
Muthu
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #1 on: April 07, 2020, 05:10:20 am »
It is not generally possible. Those interfaces are not identical in functionality.
Alex
 

Offline fchk

  • Regular Contributor
  • *
  • Posts: 244
  • Country: de
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #2 on: April 07, 2020, 05:26:01 am »
It also doesn't make any sense. There are enough USB Debug cables that can do both, so you simply don't use the other ones. Problem solved.
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #3 on: April 07, 2020, 05:37:08 am »
Hi Ataradov,

Thanks.

I have FT2232H and it supports to interface only JTAG signals...Since the SoC is having only SWD signals, I need an Interface adapter to convert SWD to JTAG and vice versa. I have found something in online, there they have connected signal as in the attached picture. I have no idea that it is a generic one that can work for me as well.

 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #4 on: April 07, 2020, 05:41:04 am »
FT2232H supports SWD in a normal bit-bang mode, it just depends on the driver. What software you are planning to use with that FT2232H?

The circuit is just a generic map from a usual JTAG pinout to SWD pinout. You still can't use JTAG driver to talk SWD.
Alex
 
The following users thanked this post: chriva

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #5 on: April 07, 2020, 05:56:47 am »
Hi Ataradov,

Thanks.FT2232H has dual ports, we are fixing one for UART and other for SWD/JTAG use.

Nowhere in FT2232H datasheet, it is saying that it supports SWD explicitly.Also, it seems that there is no driver support  for FT2232H for SWD. Regarding software to be used with FT2232H, I have no idea what is customer  going to use.
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #6 on: April 07, 2020, 06:01:17 am »
Well, that's important. It does not just magically support JTAG either. Yes, it has hardware that implements JTAG, but without the driver and the software that uses it, it is useless anyway.

It does not need to say that. FT2232H supports arbitrary pin manipulation, this is sufficient to implement SWD interface.

OpenOCD, for example supports it in that mode. And that's where your picture is coming from. But this is not a generic thing. This is something OpenOCD authors coded in their tool.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #7 on: April 07, 2020, 07:25:51 am »
Hi Ataradov,

Thanks.

It means that we need to develop SWD driver ourselves, which will be programmed into FT2232H. With the SWD driver programmed on FT2232H, can we use the circuit in the picture that I shared previously, to interface FT2232H with our SoC?
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #8 on: April 07, 2020, 07:29:54 am »
You don't need to program anything into FT2232H. It already comes with the OS drivers that let you do anything you want with any of the pins (set, clear, read). Whatever software you are using must know how to talk to those drivers and how SWD interface works.

Again, it all depends on the actual debugger/programmer software you will be using. If it does not support FT2232H already, there is not much you can do. If it does, then you don't need to do anything.

For example, if you want to debug using GDB over OpenOCD, then you don't need to do anything at all.

But if you want to debug using IAR or something like this, and there is no already supported FT2232H-based debugger, then you will have to create IAR-specific driver. And that I have no idea how to do, you would have to figure that out for each vendor individually. It is really much easier to take any general purpose  MCU and implement CMSIS-DAP interface. You will automatically gain support by all the tools.
« Last Edit: April 07, 2020, 07:33:51 am by ataradov »
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #9 on: April 07, 2020, 08:53:48 am »
Hi Ataradov,


Thanks for the detailed explanation. Still, I have one question. Provided my Software supports SWD, can I connect my SOC's SWD pins to the respective pins of FT2232H directly?


Thanks and Regards,
Muthu
 

Offline fchk

  • Regular Contributor
  • *
  • Posts: 244
  • Country: de
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #10 on: April 07, 2020, 11:57:56 am »
Thanks for the detailed explanation. Still, I have one question. Provided my Software supports SWD, can I connect my SOC's SWD pins to the respective pins of FT2232H directly?

No. The FT2232 needs additional hardware for this.
A TI XDS100v2 uses a CPLD for this.
http://software-dl.ti.com/sdo/sdo_apps_public_sw/XDS/XDS100v2Schematic(rev2)-Setup.zip

Olimex does it with gates. (non-switchable)
https://www.olimex.com/Products/ARM/JTAG/ARM-JTAG-SWD/

You may want to use this instead of FT2232H:
https://github.com/majbthrd/DapperMiser
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
Re: Is there any chip solution available to do SWD <---> JTAG conversion?
« Reply #11 on: April 07, 2020, 03:49:03 pm »
Provided my Software supports SWD, can I connect my SOC's SWD pins to the respective pins of FT2232H directly?
Your software must support SWD over FT2232H specifically, like OpenOCD does. In that case you don't need any additional adapters.
Alex
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Hi Ataradov,

Our software supports SWD. So, can we follow Openocd's  SWD to JTAG wiring diagram as attached, to connect our SoC's SWD signals to FTT2232H's JTAG ?
Do you see any issue with it?. Please suggest.

994070-0

Thanks,
Muthu



« Last Edit: May 18, 2020, 02:28:57 pm by muthukural001 »
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14464
  • Country: fr
The FT2232H absolutely supports SWD. I have actually designed a JTAG/SWD probe that can do both JTAG and SWD from the same chip.
Now of course your software must support this too. OpenOCD does.

 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14464
  • Country: fr
Our software supports SWD. So, can we follow Openocd's  SWD to JTAG wiring diagram as attached, to connect our SoC's SWD signals to FTT2232H's JTAG ?
Do you see any issue with it?. Please suggest.

It's not just about the wiring though.

Your software has to support SWD with the FT2232H. Is that the case? (It requires proper driving of it, including the change of data direction on the fly, etc.)
 

Offline muthukural001Topic starter

  • Regular Contributor
  • *
  • Posts: 211
  • Country: in
Hi SiliconWizard,

Quote
I have actually designed a JTAG/SWD probe that can do both JTAG and SWD from the same chip.
If possible, can you share the circuit that you used to interface SWD signals to FT2232H?


Thanks,
Muthu
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
What is your target uController that needs SWD?  Just get a Segger Jlink Edu mini or some other low cost programmer / debugger.
 

Offline chriva

  • Regular Contributor
  • *
  • Posts: 102
  • Country: se
Almost all of STM's controllers with SWD have built-in bootloaders which lets you use UART to program them.

There is no such thing as an electrical converter for JTAG <-> SWD since they use completely different protocols. You either get an adapter that knows how to talk the language/is electrically compatible or use the bootloader :)

It has been a while so I don't remember the details but I know you can turn a stm32f103 board into a st-link by burning the appropriate firmware to it and get a compatible programmer/debugger that way.
Some info about the built-in loader: https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf
« Last Edit: May 19, 2020, 01:18:29 pm by chriva »
 

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Almost all of STM's controllers with SWD have built-in bootloaders which lets you use UART to program them.

There is no such thing as an electrical converter for JTAG <-> SWD since they use completely different protocols. You either get an adapter that knows how to talk the language/is electrically compatible or use the bootloader :)

It has been a while so I don't remember the details but I know you can turn a stm32f103 board into a st-link by burning the appropriate firmware to it and get a compatible programmer/debugger that way.
Some info about the built-in loader: https://www.st.com/resource/en/application_note/cd00167594-stm32-microcontroller-system-memory-boot-mode-stmicroelectronics.pdf
stm32F103 nucleo board already has ST-LINK, you can reprogram it with Segger Jlink for free, but it will only work with STM32 cortex-M targets
 

Offline ataradov

  • Super Contributor
  • ***
  • Posts: 11248
  • Country: us
    • Personal site
If possible, can you share the circuit that you used to interface SWD signals to FT2232H?
You really need to understand that the circuit depends entirely on your software.

FT2232H is just a dummy USB-to-GPIO interface in this case. What pins do what is defined purely by the software.

So figure out what software wants, and you will know automatically what pins to use and the schematic will be obvious.
Alex
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14464
  • Country: fr
If possible, can you share the circuit that you used to interface SWD signals to FT2232H?
You really need to understand that the circuit depends entirely on your software.

FT2232H is just a dummy USB-to-GPIO interface in this case. What pins do what is defined purely by the software.

Not quite.
It has a not too shabby serial engine (MPSSE), which is also used for SWD (which allows to get pretty high communication speeds you could certainly never get if the serial transfers were just bitbanged.)
At least OpenOCD does make use of the MPSSE in SWD mode. You could entirely bit-bang SWD, but that would be pretty slow.

So for SWD, two of the signals (CLK and IO) can only go to specific pins of the FT2232H (if you want to make use of the MPSSE.) That's typically ADBUS0-2 (or BDBUS0-2).
You can put all other signals of course freely on other IOs of the FT2232H, and of course the software must handle data direction properly, but between direction changes, the serial engine takes care of the communication.

As for sharing a schematic, that's actually one project I did entirely with a schematic-less design entry tool I designed like 1 1/2 year ago (you could probably find the thread in the EDA section), so I have no schematic to share for this to speak of unfortunately, and the source file for the design would probably not help you much without extensive explanations. As said above, all that matters is to wire SWDCLK and SWDIO to respectively TCK and TDI/TDO pins of the corresponding channel on the FT2232H as the schematic you posted shows. The other required control pins will all depend on your software as they are just GPIOs, and are configurable if you use OpenOCD. Take a look at some interface config files for OpenOCD to figure it out, and I think it's also documented in OpenOCD's docs.
« Last Edit: May 19, 2020, 04:13:54 pm by SiliconWizard »
 

Offline profdc9

  • Frequent Contributor
  • **
  • Posts: 319
  • Country: us
OpenOCD has CFG files already for the cheaper FT232H in SWD mode

https://github.com/unprovable/FTDI-Oh-My/blob/master/FT232H-openOCD.cfg
https://github.com/ntfreak/openocd/blob/master/tcl/interface/ftdi/ft232h-module-swd.cfg

You could probably buy any FT232H breakout off of ebay/aliexpress and connect it up as shown in the cfg files, and it should talk SWD.

If you use OpenOCD, there's very little to do, as it already knows how to talk SWD using the MPSSE engine of the FT232H.

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf