[SOLVED] Need help with ESP-PROG + ESP32 debugging

filo_gr
Posts: 110
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

[SOLVED] Need help with ESP-PROG + ESP32 debugging

Postby filo_gr » Sat Mar 19, 2022 1:39 pm

Hello! I tried to setup the Openocd debbuger on VSCode to debug a simple software working in an ESP32 (This one, that is a DOIT ESP32 https://it.aliexpress.com/item/32799253 ... 3696TdQRqC).
I'm working with ESP-IDF v4.4 on Windows 11. I use the ESP-PROG to debug (https://it.aliexpress.com/item/33048891 ... 3696s7Mwsj).
I followed the tutorials explained in the following pages: I followed the instructions and I used Zadig to install the USB driver for the ESP-PROG.

The set-up I produced is the following:
  • My lanch.json

Code: Select all

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "espidf",
      "name": "Launch",
      "request": "launch"
    },
    {
      // nome personalizzato
      "name": "ESP32 OpenOCD",
      // cpp debugger
      "type": "cppdbg",
      "request": "launch",
      // percoroso del debugger, dipende da toolchain
      "miDebuggerPath": "C:/esp/tools/tools/xtensa-esp32-elf/esp-2021r2-patch2-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb.exe",
      // current working directory
      "cwd": "${workspaceFolder}/build",
      //change the name of the elf file as required (fare una build per trovarlo)
      // è del tipo nome_progetto.elf
      // usare copy path per andare sul sicuro per il percorso
      "program": "C:/Users/Filippo/Documents/Espressif/manual_debug/build/manual_debug.elf",
      "setupCommands": [
        {
          "description": "Enable pretty-printing for gdb",
          "text": "-enable-pretty-printing",
          "ignoreFailures": true
        },
        {
          // there's a bug in vs code that prevents us from using ${workspaceFolder} variable.
          // update the path as needed
          // stesso percorso messo prima
          "text": "file 'C:/Users/Filippo/Documents/Espressif/manual_debug/build/manual_debug.elf'"
        },
        {
          // configurazione openocd
          "text": "target remote 127.0.0.1:3333"
        },
        {
          // Limite di breakpoint hardware che supporta ESP32
          "text": "set remote hardware-watchpoint-limit 2"
        },
        {
          // reset ESP32 e lo blocca
          "text": "monitor reset halt"
        },
        {
          // flush dei registri interni esp
          "text": "flushregs"
        },
      ],
      "externalConsole": false,

      "logging": {
         "trace": true,
         "traceResponse": true,
         "engineLogging": true
      }
    }
  ]
}
  • ESP-PROG: Pin Vjtag to ESP32: 3V3
  • ESP-PROG: Pin GND to ESP32: GND
  • ESP-PROG: Pin TMS to ESP32: G14
  • ESP-PROG: Pin TCK to ESP32: G13
  • ESP-PROG: Pin TDO to ESP32: G15
  • ESP-PROG: Pin TDI to ESP32: G12
I'm using a simple code to test the debugger, if needed I can share it. However I think the problem is something else.

1) if I try to flash the ESP32 via the UART method (WITH THE ESP-PROG CONNECTED TO IT), It fails with the message:

Code: Select all

Uploading stub...
Running stub...Stub running...Changing baud rate to 460800Changed.
WARNING: Failed to communicate with the flash chip, read/write operations will fail. Try checking the chip connections or removing any other hardware connected to IOs.
Configuring flash size...
Warning: Could not auto-detect Flash size (FlashID=0xffffff, SizeID=0xff), defaulting to 4MB
Flash will be erased from 0x00010000 to 0x00039fff...Flash will be erased from 0x00001000 to 0x00007fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Compressed 169568 bytes to 89379...

A fatal error occurred: Packet content transfer stopped (received 8 bytes)
The terminal process "c:\esp\tools\python_env\idf4.4_py3.8_env\Scripts\python.exe 'c:\esp\esp-idf\components\esptool_py\esptool\esptool.py', '-p', 'COM3', '-b', '460800', '--before', 'default_reset', '--after', 'hard_reset', '--chip', 'esp32', 'write_flash', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', '0x10000', 'manual_debug.bin', '0x1000', 'bootloader/bootloader.bin', '0x8000', 'partition_table/partition-table.bin'" terminated with exit code: 2.
2) To avoid this, I flash the ESP32 and after that I connect the pins of the ESP-PROG. I run the command

Code: Select all

openocd -f debug\esp32_devkitj_v1.cfg -f debug\esp-wroom-32.cfg
(the configuration file are copied inside my debug folder).
This is the output in this case:

Code: Select all

Open On-Chip Debugger  v0.11.0-esp32-20211220 (2021-12-20-15:43)                                                   Licensed under GNU GPL v2                                                                                          For bug reports, read   ments\Espressif\manual_debug>
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
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)
Warn : target esp32.cpu1 examination failed
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : starting gdb server for esp32.cpu0 on 3333
Info : Listening on port 3333 for gdb connections
I go to Run and debug option in VSCODE and I start debugging.
Here the pic of the log:
bug.png
bug.png (203.1 KiB) Viewed 6659 times
In other words, the debugger won't start. This is the first time I use the ESP-PROG.
Thank you
Last edited by filo_gr on Mon Mar 21, 2022 7:16 am, edited 1 time in total.
Filippo

RabbitRF
Posts: 15
Joined: Tue Mar 01, 2022 12:28 am

Re: Need help with ESP-PROG + ESP32 debugging

Postby RabbitRF » Sun Mar 20, 2022 7:15 am

Hello,

I have similar problem when I start openOCD; here is the message:


\blink>openocd -f board/esp32-wrover-kit-3.3v.cfg
Open On-Chip Debugger v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
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 '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'

Assertion failed!

filo_gr
Posts: 110
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: Need help with ESP-PROG + ESP32 debugging

Postby filo_gr » Sun Mar 20, 2022 11:33 am

RabbitRF wrote:
Sun Mar 20, 2022 7:15 am
Hello,

I have similar problem when I start openOCD; here is the message:


\blink>openocd -f board/esp32-wrover-kit-3.3v.cfg
Open On-Chip Debugger v0.11.0-esp32-20211220 (2021-12-20-15:43)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
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 '*'
Error: no device found
Error: unable to open ftdi device with vid 0403, pid 6014, description '*', serial '*' at bus location '*'

Assertion failed!
Look at this https://www.youtube.com/watch?v=LP4_UOl9wnU.
And please, open another topic if you encounter other problems ;)
Filippo

filo_gr
Posts: 110
Joined: Wed Jul 28, 2021 12:25 pm
Location: Italy

Re: Need help with ESP-PROG + ESP32 debugging

Postby filo_gr » Mon Mar 21, 2022 7:15 am

I solved these problem, firstly by using another configuration file for the debug interface: the esp32-wrover-kit-3.3v.cfg.

1) This problem I think it's due to the fact the ESP-PROG is connected to the programming pins of the ESP32. Hence, if it is switched on during the programming of the ESP32, it could interfere with the programming procedure. To solve this I firstly program the ESP32 and then I connect the debugger.

2) This problem is a little bit strange: I noticed it happens often when I start the debug. To solve this I repeat the debug process until it works... :cry:
Filippo

Who is online

Users browsing this forum: Majestic-12 [Bot] and 74 guests