EthKit v1.2 Debugging issues

rfleming
Posts: 62
Joined: Tue Oct 09, 2018 12:30 am

EthKit v1.2 Debugging issues

Postby rfleming » Thu Dec 03, 2020 7:37 am

Hi all,

I have been using the esp32 variants for some-time now and I have finally decided to try and setup the debugging tools so I dont have to use the printf/delay option anymore for analysing code.

I have an Ethernetkit v1.2 that comes with the on-board jtag, having started with several issues myself, I followed the documentation at:
https://docs.espressif.com/projects/esp ... ight=zadig
and
https://docs.espressif.com/projects/esp ... un-openocd

Though I keep getting stuck, I can confirm the WinUSB driver has overridden the older default windows one and I am now left with only 1 comport for general purpose UART as expected. Note that I currently have a completely new board, no peripherals are connected to it and all switches are in their default "ON" positions.
When I run the suggested command, though modified for my board I get:

Code: Select all

$ openocd -f board/esp32-ethernet-kit-3.3v.cfg
Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:19)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: type 'esp32' is missing virt2phys
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
No matter what I do or what driver/configuration I get I always seem to get the below errors.

Code: Select all

Error: type 'esp32' is missing virt2phys
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
If however the WinUSB drivers we not installed, I would instead get a different message:

Code: Select all

Info : Configured 2 cores
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: type 'esp32' is missing virt2phys
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Error: libusb_open() failed with LIBUSB_ERROR_ACCESS
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6010, description '*', serial '*' at bus location '*'
So since installing it, it does appear to be working slightly better. Though still failing, but slightly less...

Finally, after reading a little bit around and playing with the vs code launch/tasks, and reading various forum posts etc. I ended up with some configuration options that should work better in the long run, though still fail for the same reason as #1.

Code: Select all

> Executing task: openocd -s share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-ethernet-kit-3.3v.cfg -c "init; reset halt; program_esp build/bootloader/bootloader.bin 0x1000 verify; program_esp build/partition_table/partition-table.bin 0x8000 verify; program_esp build/TestApp.bin 0x10000 verify" <

Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:19)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Warn : Interface already configured, ignoring
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
Error: type 'esp32' is missing virt2phys
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
If anyone could assist with this it would be awesome! I am very much looking forward to moving on from the my printf/delay debugging.

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: EthKit v1.2 Debugging issues

Postby ESP_Sprite » Sat Dec 05, 2020 3:08 am

It looks like the host adapter works, but the ESP32 is not reacting. Aside from the usual things (wires connected OK, nothing else on GPIO12-15, ...) you may want to check if any code running on the ESP32 is re-using GPIO12-15 as something else... this makes JTAG not work.

rfleming
Posts: 62
Joined: Tue Oct 09, 2018 12:30 am

Re: EthKit v1.2 Debugging issues

Postby rfleming » Tue Dec 08, 2020 4:53 am

Solid step in the right direction. Still interesting that I am getting the esp32 missing and libusb_open() failed though :(

Everywhere I found elsewhere online, people have identified that simply installing the drivers with zadig solves these issues. Unfortunately they only removed the line that said it couldn't find the ftdi chip.

Code: Select all

> Executing task: openocd -s share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-ethernet-kit-3.3v.cfg -c "init; reset halt; program_esp build/bootloader/bootloader.bin 0x1000 verify; program_esp build/partition_table/partition-table.bin 0x8000 verify; program_esp build/BumpStation.bin 0x10000 verify" <

Open On-Chip Debugger  v0.10.0-esp32-20191114 (2019-11-14-14:19)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
none separate
adapter speed: 20000 kHz
Warn : Interface already configured, ignoring
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
Error: type 'esp32' is missing virt2phys
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
Info : clock speed 20000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32: Debug controller 0 was reset.
Info : esp32: Core 0 was reset.
Info : esp32: Debug controller 1 was reset.
Info : esp32: Core 1 was reset.
Info : Listening on port 3333 for gdb connections
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: EthKit v1.2 Debugging issues

Postby ESP_Sprite » Tue Dec 08, 2020 7:16 am

This actually looks like a successful OpenOCD startup sequence. You can likely ignore the libusb error message; possibly it thinks some other device on your machine can also be used as a JTAG adapter, failing when it tries, before processing to the *actual* adapter.

rfleming
Posts: 62
Joined: Tue Oct 09, 2018 12:30 am

Re: EthKit v1.2 Debugging issues

Postby rfleming » Thu Dec 10, 2020 1:16 am

I hope this is on the correct forum for this part...nevertheless:

Assuming you're correct. Perhaps its my lack of knowledge or the wrong command in here, though it does not progress any further into debugging my IC with the VSCode IDE. That is I was hoping it would restart my processor and pause on main() (or app_main()) program entry. Though once the above executes, it just sits there. Perhaps I am missing another step?

Currently when I click "Start Debug" in VSCode it builds my project (I haven't made it program it yet in the debug args) then starts the debug sessions. Though doesn't proceed any further. You can see the command it uses above in the post. Though for a more specific set of settings used:

Code: Select all

//launch.json
{
    "version": "0.2.0",
    "configurations": [
      {
        "type": "gdb",
        "request": "launch",
        "name": "Launch Program",
        "target": "${workspaceFolder}/build/${workspaceFolderBasename}.elf",
        "cwd": "${workspaceFolder}",
        "gdbpath": "xtensa-esp32-elf-gdb",
        "autorun": [
          "target remote :3333",
          "mon reset halt",
          "flushregs",
          "thb app_main",
          "c"
        ],
        "preLaunchTask": "openocd"
      }
    ]
}

Code: Select all

//tasks.json
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "build",
            "type": "shell",
            "isBackground": true,
            "options": {
                "cmd": "${workspaceFolder}"
            },
            "command": "idf.py build",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "openocd",
            "type": "shell",
            "isBackground": true,
            "options": {
                //"cmd": "${workspaceFolder}"
                "cwd": "${workspaceFolder}"
            },
            "dependsOn": "build",
            "command": "openocd",
            "args": [
                "-s",
                "share/openocd/scripts",
                "-f",
                "interface/ftdi/esp32_devkitj_v1.cfg",
                "-f",
                "board/esp32-ethernet-kit-3.3v.cfg",
                "-c",
                "\"init; reset halt; program_esp build/bootloader/bootloader.bin 0x1000 verify; program_esp build/partition_table/partition-table.bin 0x8000 verify; program_esp build/${workspaceFolderBasename}.bin 0x10000 verify\""
            ]
            //"command": "openocd -f interface/jlink.cfg -f board/esp32-ethernet-kit-3.3v.cfg",
            //"command": "openocd -s share/openocd/scripts -f board/esp32-ethernet-kit-3.3v.cfg",
        }
    ]
}

Who is online

Users browsing this forum: No registered users and 25 guests