-
Notifications
You must be signed in to change notification settings - Fork 67
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
bscan_tap module - how does it work? #29
Comments
More question: |
Hi @agrobman, The It works this way: If the JTAG debugger writes one of the special "user instructions" to the FPGA's JTAG instruction register, the following JTAG data scans will go directly to the user design through the BSCANE2 instances. In SweRVolf, this mechanism is utilized to expose SweRV's JTAG registers of SweRV in the JTAG TAP of the FPGA. Pointers to Xilinx documentation about BSCANE2:
Hope this helped to answer at least some of your questions. Jan |
Thanks @JanMatCodasip, That sums it up quite well. I guess the other half of the answer is why we do it like this. On the Nexys A7 board, the dedicated FPGA JTAG pins are connected to an FTDI chip together with the UART channel. This way we only need to connect a single USB cable to the board for power, UART and JTAG instead of requiring a separate JTAG adapter. In extension, by exposing the debug interface from the CPU instead of the JTAG pins, this allows us to tunnel the debug interface over basically any connection. Not all FPGA boards have JTAG-to-USB or even convenient user-accessible I/O pins. We could e.g. do debug over ethernet or debug over UART or debug over pciE if those are more convenient ways to access the SoC on other boards |
thanks Olof and Jan for explanation, BTW, FTDI chip has two serial channels can be configured as JTAG IFs, Can the 2nd one be connected/used as original swerv JTAG interface to test original JTAG logic? what's about my 2nd question(s)? what is clk_gen_nexus module? and where the user_clk, user_rst signals driven from? |
That part about the missing FTDI connections rang a bell so I did some research and yep, been through this before. :) So to sum it up, it's a good idea and it might be possible. It seems like at least tx, rx, cts and rts are connected and if we're lucky enough they might map to the four jtag pins we need. But further investigation would be needed. Regarding the other question, user_clk and user_rst are created by PLLs in the DDR controller. Those PLLs are in turn driven by the external 100MHz input clock. I took the opportunity to make a clocking diagram. Will clean this up and add to the doccs eventually |
thanks Olof,
|
I am afraid it is not possible. If the pins BDBUS2 & BDBUS3 of the FTDI chip on Nexys A7 were connected to some FPGA's general purpose I/Os, it would be possible to have a standard 4-wire JTAG on the channel B of the FTDI chip. Unfortunately, those pins are not connected. The USB-to-JTAG part of the Nexys A7 design is proprietary (Digilent does not provide its schematic), but they at the very least confirmed to me that these two pins are not connected on the board: https://forum.digilentinc.com/topic/18999-arty-a7-fpga-board-access-to-pins-bdbus2-and-bdbus3-of-ft2232h/ So the options are:
|
or solder these two pins to some FPGA IO/connector (QFP package pins are exposed to soldering ...) I agree that for general public current solution is the best, but not that good for debugger vendors and somebody wants to use swerv as is, without modifications. |
the 2nd option is questionable. |
Correct, in Digilent JTAG HS2 there is no TRST output. From user perspective, this is not important. TRST is optional in the JTAG standard. The debugger can replace the assertion of TRST by issuing 5x TMS=1, which also causes the FSM inside the JTAG TAP to transtion to its initial state. If TRST is really needed some reason, you may pick a debug adapter that contains TRST. For example:
I don't think there is an issue with exposing the JTAG signals onto the FPGA pins. Do you see any specific concern here?
OpenOCD has its configuration commands that allow to specify which JTAG adapter to use. The list of adapters that OpenOCD supports is in the documentaiton, incl. their configurable options: http://openocd.org/doc/html/Debug-Adapter-Configuration.html#Debug-Adapter-Configuration Usually you don't need to configure the adapter yourself, as there are ready-made configuration files for the supported adapters, shipped with OpenOCD: https://github.com/riscv/riscv-openocd/tree/riscv/tcl/interface |
Soldering custom wires to the board to interconnect FT2232 and the FPGA pins is possible, but I do not recommend it. It is inherently unreliable (small QFN pads). Other than saving few $ for an external debug adapter, it brings no advantage. |
I meant to use FPGA TDI/TDO/TCK/TMS pins as SweRV JTAG pins. Does Vivado allow to reuse these pins for emulated design? Regarding adapters - I couldn't find one which can be seamlessly connected to the board PMOD connectors .. Adapter's connectors pinouts don't have VREF/GND pins in the same place, where the board has them :( So looks like we'll need to do some soldering if we want to emulate original JTAG design .. |
My understanding is that TDI, TDO, TCK & TMS FPGA pins cannot be re-purposed for the user design. The only (limited) way how to use them for custom purposes is through the BSCAN primitive, as SweRVolf does.
If operation without TRST is sufficient, then Digilent JTAG-HS2 can be used. It fits into a PMOD connector directly, see the picture. It works well and I often use it this way (also on other processors than SweRV). If you'd like to have TRST, too, then my recommendation is to take one of the USB-JTAG adapters that have it (Segger J-Link, ARM-USB-TINY-H, ....). Then build a simple custom adapter between the standard JTAG 20-pin connector and the PMOD connector on Nexys A7. |
Jan, BTW, did you ever use/check original SwerV DMI module in FPGA emulation with any debugger? |
Yes, I have worked with plain-vanilla SweRV w/ original DMI & JTAG interface on the Nexys A7 board. It was some time ago, though. The debug adapter was Olimex ARM-USB-TINY-H. I believe it was SweRV version 1.4 or 1.5. Since then, I've been using SweRVolf. |
Newbie question for @JanMatCodasip regarding the photo showing the JTAG-HS2 connected to the pmod JD on the Nexys A7: I'm trying to set up the same connection, JTAG-HS2 to pmod JD, but not sure whether to use the top row or the bottom row of the pmod (the pmod is 2x6)? Also, if I connect the JTAG-HS2 to the jumper J10 do you think that will work too? |
@MatthewMFLai Is there any particular reason you need a separate JTAG cable? SweRVolf supports both JTAG, UART and power over the same USB connection and this is the normal way to connect a debugger |
@olofk Oh I'm not using SweRVolf here (and I do apologize for asking a non-SwerRVolf question in this forum). The RISC-V that I'm testing with the Nexys A7 explicitly mentions using the JTAG-HS2 to connect to the Nexys A7, and then I googled and found the picture from @JanMatCodasip, that's why I'm asking here. |
Hi @MatthewMFLai, so this is not SweRVolf-related question, all right. In general, if you work with a 3rd party design on Nexys A7 board, it is best to ask the author where the JTAG pins are mapped in that particular design. There is no "standard" and the designer is free to pick any of the general-purpose pins on the Nexys A7 board. So in other words, the JTAG pins could be anywhere. |
@JanMatCodasip HI, BSCAN is very good design for the single debug connection, but I found a problem with it , that is when I tried the ila inserting to netlist to debug some issue , the usb-jtag connection is occupied by vivado, open-ocd can't connect to SWERV core, which cause I can't download testing code. is there any way to resolve it with single jtag usb connection? the solution I can get is to sperarate debug jtag connection to PMOD |
That is a very valid comment, and I would like to have the option to support an external JTAG adapter through PMOD for other reasons as well. It shouldn't be too much work but hasn't been done yet |
Hi Olof,
I'm new in FPGAs and wondering how does your bscan_tap module work ? where are the definitions / descriptions of the BSCAN2 modules? How are some internal wires driven?
Thanks in advance
Alex
The text was updated successfully, but these errors were encountered: