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

Error: Check JTAG interface, etc #877

Closed
cmenendezzz opened this issue Jul 4, 2023 · 16 comments
Closed

Error: Check JTAG interface, etc #877

cmenendezzz opened this issue Jul 4, 2023 · 16 comments

Comments

@cmenendezzz
Copy link

Hi, I have encountered a technical issue working on a project in the NEXYS A7 100t board. Specifically, I am facing difficulties in establishing a connection with the JTAG interface with OPENOCD.

Due to the fact that J10 ports are not being recognized by Vivado, I have resorted to using a PMOD to extract the signals for JTAG. I have connected the JTAG HS2 and modified the OpenOCD configuration file accordingly. However, I am currently unable to establish a successful connection.

I have thoroughly reviewed my setup and configuration to ensure that all connections and settings are correct. Despite my efforts, I have been unable to resolve the connectivity issue. I have also consulted relevant documentation and online resources, but the problem persists.

Here you can see the error and the configuration files.

Thank you in advance for your time.

image

image

image

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 4, 2023

Whatever JTAG dongle is being used here seems to have TDO stuck at 1 so nothing is going to work in terms of OpenOCD/JTAG communication with the target.

I don't really understand the nature of the JTAG dongle you're using with OpenOCD here. Maybe you can explain in more detail? Explaining the schematics and setup of this may help. Also, the output of lsusb with the JTAG connected may be useful.

BTW log output is preferable to screenshots for the purposes of diagnosis and analysis.

@cmenendezzz
Copy link
Author

The idea is as follows: I want to synthesize the NEIRV32 on a NEXYS A7. I have been able to do this (including generating the bitstream and programming the device). Once this is done, the next step I want to take is to enable debugging using the JTAG HS2 probe. For this, on the one hand, I need to download GDB and configure it with my IDE (if I understood correctly), and on the other hand, configure OpenOCD. Currently, I am working on the latter but encountering the errors I mentioned earlier. You can find a schematic of the problem below.

file:///home/claudia/Downloads/IMG_9138.jpg

Also, here are the results of the 'lsusb' command.

claudia@claudia-VirtualBox:~$ lsusb
Bus 001 Device 004: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

Finally, initially, I took inspiration from your HS2 config file. However, I had to add underscores ('_') in some of the commands. I was wondering if this was due to an older version of FTDI, or because I'm in a Linux environment, or something else. Thank you in advance.

@cmenendezzz
Copy link
Author

IMG_9138

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 4, 2023

For this, on the one hand, I need to download GDB and configure it with my IDE (if I understood correctly), and on the other hand, configure OpenOCD.

I don't really understand your points here.

If you want to use the latest OpenOCD with RISC-V support then build it as follows:

# Install any prerequisites - includingg those required in order to enable the required JTAG interface(s)
git clone https://github.com/riscv/riscv-openocd
cd riscv-openocd
./bootstrap
./configure --prefix=..
make install

Currently, I am working on the latter but encountering the errors I mentioned earlier.

Your main problem is that TDO is stuck at 1 so no communication with your target is going to work.
You need to figure out why TDO is stuck at 1.
It might also be an idea - from a process of elimination point of view - to get your HS2 based JTAG connection working with a known good target first just to eliminate your FPGA RISC-V as being the culprit.

Finally, initially, I took inspiration from your HS2 config file. However, I had to add underscores ('_') in some of the commands.

Again you are not explaining the issue here clearly enough.
What config file?
What "inspiration"?
What commands?

Also, here are the results of the 'lsusb' command.

Sorry - I meant lsusb -v.

@TommyMurphyTM1234
Copy link
Collaborator

In case there's anything useful here...

@cmenendezzz
Copy link
Author

Again you are not explaining the issue here clearly enough.
What config file?
What "inspiration"?
What commands?

By executing the configuration file of the hs2 ( which can be found in riscv-openocd/tcl/interface/ftdi) an error occurs:

Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
digilent-hs2.cfg:6: Error: invalid command name "ftdi"
in procedure 'script' 
at file "embedded:startup.tcl", line 26
at file "digilent-hs2.cfg", line 6

Configuration file:

adapter driver ftdi
ftdi device_desc "Digilent Adept USB Device"
ftdi vid_pid 0x0403 0x6014

ftdi channel 0
ftdi layout_init 0x00e8 0x60eb

reset_config none

Whereas if a do the following modification , this error disappears. My question is if there is a mistake in the original file or my Linux environment is supposed to know those commands and he actually don't.

New configuration file:

adapter driver ftdi
ftdi_device_desc "Digilent Adept USB Device"
ftdi_vid_pid 0x0403 0x6014

ftdi_channel 0
ftdi_layout_init 0x00e8 0x60eb

reset_config none

The error disappears:

claudia@claudia-VirtualBox:~/riscv-openocd/tcl/interface/ftdi$ openocd -f digilent-hs2.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
none separate

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description 'Digilent Adept USB Device', serial '*' at bus location '*'

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 4, 2023

Whereas if a do the following modification , this error disappears.

You seem to have a mismatch of OpenOCD version and script version.
In fact you seem to be using an out of date OpenOCD.
If it accepts/requires the old command format (ftdi_device_desc) rather than the new one (ftdi device_desc) it is old.
If you build the latest RISC-V OpenOCD fork as I explained earlier you should not need to edit the Diligent HS2 configuration file.

@cmenendezzz
Copy link
Author

Your main problem is that TDO is stuck at 1 so no communication with your target is going to work.
You need to figure out why TDO is stuck at 1.
It might also be an idea - from a process of elimination point of view - to get your HS2 based JTAG connection working with a known good target first just to eliminate your FPGA RISC-V as being the culprit.

It is the first time I am doing this, that is why is quite frustrating sometimes... I am going to keep looking why it is stuck at 1.

Also, I forgot to precise on the last message that I used the latest OpenOCD with RISC-V support as you told me to.

Finally, concerning the results of the lsusb -v command:

claudia@claudia-VirtualBox:~/riscv-openocd/tcl/interface/ftdi$ lsusb -v

Bus 001 Device 004: ID 0403:6014 Future Technology Devices International, Ltd FT232H Single HS USB-UART/FIFO IC
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0403 Future Technology Devices International, Ltd
  idProduct          0x6014 FT232H Single HS USB-UART/FIFO IC
  bcdDevice            9.00
  iManufacturer           1 Digilent
  iProduct                2 Digilent USB Device
  iSerial                 3 210249B868A9
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              2 Digilent USB Device
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0002 2.0 root hub
  bcdDevice            5.19
  iManufacturer           3 Linux 5.19.0-46-generic ehci_hcd
  iProduct                2 EHCI Host Controller
  iSerial                 1 0000:00:0b.0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0019
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval              12

Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         8
  idVendor           0x80ee VirtualBox
  idProduct          0x0021 USB Tablet
  bcdDevice            1.00
  iManufacturer           1 VirtualBox
  iProduct                3 USB Tablet
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0022
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.10
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      85
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0008  1x 8 bytes
        bInterval              10

Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            9 Hub
  bDeviceSubClass         0 
  bDeviceProtocol         0 Full speed (or root) hub
  bMaxPacketSize0        64
  idVendor           0x1d6b Linux Foundation
  idProduct          0x0001 1.1 root hub
  bcdDevice            5.19
  iManufacturer           3 Linux 5.19.0-46-generic ohci_hcd
  iProduct                2 OHCI PCI host controller
  iSerial                 1 0000:00:06.0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0019
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xe0
      Self Powered
      Remote Wakeup
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         9 Hub
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 Full speed (or root) hub
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0002  1x 2 bytes
        bInterval             255

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 4, 2023

OK - my recommendations:

  1. Clone, configure and build the latest RISC-V OpenOCD as explained earlier.
  2. (You may need to install prerequisites including libusb-1.0-0-dev in order to bootstrap, configure and build OpenOCD with FTDI interface support).
  3. Make sure that it supports the Diligent HS2 interface (check the configuration log and the output of openocd -c "adapter list")
  4. Use the Diligent HS2 configuration script as-is - you should no longer need to modify it
  5. If possible, check that OpenOCD and Diligent HS2 work to connect to a known good debug target - not your FPGA design which may or may not be working
  6. Finally try to connect to your FPGA design - if TDO remains stuck then you probably have some problem with the design or configuration of your target.

@cmenendezzz
Copy link
Author

Thank you very much for your help! I am going to follow you recommendations step by step and erase the older openocd that I downloaded. Again, thank you for your time, all your answers have been very useful!

@TommyMurphyTM1234
Copy link
Collaborator

You're welcome.
I would suggest that you also double check your FPGA design to ensure that the target RISC-V and, in particular, debug block and JTAG are properly functional.
Perhaps by doing some appropriate simulated tests of the HDL.

@cmenendezzz
Copy link
Author

Hello again!

I managed to successfully install the latest version of OpenOCD and I verified the debug block. Nevertheless, I noticed that by erasing the command ftdi device_desc "Digilent Adept USB Device" in the configuration file, I obtain different results. Is this command very important?

Here you can see the error before erasing this command:

$ sudo openocd -f riscv-openocd/tcl/interface/ftdi/digilent-hs2.cfg -f neorv32/sw/openocd/openocd_neorv32.cfg
Open On-Chip Debugger 0.12.0+dev-02948-g92c031926 (2023-07-05-09:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
none separate

Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description 'Digilent Adept USB Device', serial '*' at bus location '*'

And here afterwards:

$ sudo openocd -f riscv-openocd/tcl/interface/ftdi/digilent-hs2.cfg -f neorv32/sw/openocd/openocd_neorv32.cfg
Open On-Chip Debugger 0.12.0+dev-02948-g92c031926 (2023-07-05-09:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
jtag
Info : clock speed 2000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: neorv32.cpu: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: dtmcontrol is 0. Check JTAG connectivity/board power.
Warn : target neorv32.cpu.0 examination failed
Info : starting gdb server for neorv32.cpu.0 on 3333
Info : Listening on port 3333 for gdb connections
Error: Target not examined yet

Finally, this is the configuration file I am using:

# SPDX-License-Identifier: GPL-2.0-or-later

# this supports JTAG-HS2 (and apparently Nexys4 as well)

adapter driver ftdi
#ftdi device_desc "Digilent Adept USB Device"
ftdi vid_pid 0x0403 0x6014

ftdi channel 0 
ftdi layout_init 0x00e8 0x60eb
adapter speed 2000
transport select jtag
reset_config none

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 5, 2023

What happens if you use the string from the earlier lsusb -v output?

ftdi device_desc "Digilent USB Device"

This may also be relevant:

Either way, I don't think that the ftdi device_desc command really matters.

You still have the original problem - i.e. that TDO is stuck at 1.
So you should ideally verify that your JTAG connection works with a known good debug target such as an off the shelf MCU/board (e.g. some arm Cortex-M target if possible) and also recheck your FPGA design for issues, including simulating it to verify that the debug block/JTAG is functionally correct if possible.

BTW you shouldn't have to use sudo to run OpenOCD and doing so is not good practice. If, when you run it without root privileges it cannot see the JTAG device at all, then the issue is almost certainly that you need to install the OpenOCD udev rules file.

Usually this involves something like this:

  1. sudo cp <path-into-openocd-installation>/60-openocd.rules /etc/udev/rules.d
  2. udevadm trigger
  3. make sure that your user name is a member of the plugdev group
  4. In some cases you may also need to log out/in again or reboot

@TommyMurphyTM1234
Copy link
Collaborator

TommyMurphyTM1234 commented Jul 5, 2023

Isn't this a (the?) known good implementation of neorv32 on the Nexus A7 board? Did you try it making sure to follow the instructions to the letter?

You might be better asking about debug issues with this combination of soft IP and FPGA board over at the neorv32 project?

FWIW here are some other people having problems with TDO:

I guess that you should double check the pin mappings and attributes for your JTAG signals and check the physical setup using a probe and/or logic analyser if possible.

@cmenendezzz
Copy link
Author

Indeed I am implementing the NEORV32 on the Nexus A7 board.

Thank you very much! I did what you told me ( concerning the user privileges) and look at the doubts posted by other users and I forgot to put the reset jtag signal at high ( as it is optional i did not think about putting it at a high level).

I manage to solve all my problems ! Thank you very much for your time and patience .

@TommyMurphyTM1234
Copy link
Collaborator

Glad you got things sorted in the end.
Can you close the issue now please?
Thanks.

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

2 participants