Unable to connect J-Link JTAG to ESP32

raja sumant
Posts: 10
Joined: Tue Nov 09, 2021 5:43 am

Unable to connect J-Link JTAG to ESP32

Postby raja sumant » Tue Nov 16, 2021 12:00 pm

When I ran openocd, I got the following error.

Code: Select all

raja@raja-IdeaPad-Gaming-3-15IMH05:~/esp32DevelopmentToolChain/esp-idf/projects/EnergyMeter$ openocd -s tcl -f interface/jlink.cfg -f board/esp-wroom-32.cfg
Open On-Chip Debugger  v0.10.0-esp32-20210902 (2021-09-02-09:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
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
Info : J-Link V9 compiled May  7 2021 16:26:12
Info : Hardware version: 9.70
Info : VTarget = 3.316 V
Error: JTAG I/O operation failed: 0x1.
Error: jaylink_jtag_io() failed: device: unspecified error.
Error: An adapter speed is not selected in the init script. Insert a call to adapter_khz or jtag_rclk to proceed.

openocd: ../src/jtag/core.c:343: jtag_checks: Assertion `jtag_trst == 0' failed.
Aborted (core dumped)
I am trying to get the JTAG connected for debugging.

I followed these connections:

Image

I am first trying to get it connected so that I interface it with Eclipse

raja sumant
Posts: 10
Joined: Tue Nov 09, 2021 5:43 am

Re: Unable to connect J-Link JTAG to ESP32

Postby raja sumant » Wed Nov 17, 2021 7:30 am

I edited the esp-wroom-32.cfg file to include

Code: Select all

adapter_khz 1000
Now the debugger connects but the ESP32 keeps on resetting.

I have no clue on why this keeps happening.

If anyone can help me, it would be great.

raja sumant
Posts: 10
Joined: Tue Nov 09, 2021 5:43 am

Re: Unable to connect J-Link JTAG to ESP32

Postby raja sumant » Wed Nov 17, 2021 8:03 am

I was able to connect the jlink with openocd command and flash it but I am unable to launch the gui debug.

Flash:
Screenshot from 2021-11-17 13-31-25.png
Screenshot from 2021-11-17 13-31-25.png (392.95 KiB) Viewed 5994 times
Please suggest if the program got flashed as expected.

Connect openocd:
Screenshot from 2021-11-17 10-22-52.png
Screenshot from 2021-11-17 10-22-52.png (371.61 KiB) Viewed 5994 times
However, I am unable to open the gui mode using both idf.py or openocd or through eclipse.

raja sumant
Posts: 10
Joined: Tue Nov 09, 2021 5:43 am

Re: Unable to connect J-Link JTAG to ESP32

Postby raja sumant » Thu Nov 18, 2021 6:14 am

Can anyone guide me on the proper way of overriding the openocd command for launching gdbgui ?

I tried this:

Code: Select all

raja@raja-IdeaPad-Gaming-3-15IMH05:~/esp32DevelopmentToolChain/esp-idf/projects/EnergyMeter$ idf.py openocd --openocd-scripts interface/jlink.cfg --openocd-scripts board/esp-wroom-32.cfg gdbgui
Executing action: openocd
Note: OpenOCD cfg not found (via env variable OPENOCD_COMMANDS nor as a --openocd-commands argument)
OpenOCD arguments default to: "-f board/esp32-wrover-kit-3.3v.cfg"
OpenOCD started as a background task 17425
Executing action: gdbgui
gdbgui started as a background task 17426
Open On-Chip Debugger  v0.10.0-esp32-20210902 (2021-09-02-09:38)
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: 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 '*'

openocd: ../src/jtag/core.c:343: jtag_checks: Assertion `jtag_trst == 0' failed.

cleaning up debug targets
Please check JTAG connection!
Action "gdbgui" failed due to errors in OpenOCD:
Please check JTAG connection!
It failed.

Please provide the command for idf.py [command line ] as well as just openocd.

Help is appreciated. TIA.

raja sumant
Posts: 10
Joined: Tue Nov 09, 2021 5:43 am

Re: Unable to connect J-Link JTAG to ESP32

Postby raja sumant » Thu Nov 18, 2021 8:54 am

I fixed the issue by following the below steps:

Firstly, I changed the adapter frequency to 1 KHz

Secondly, I started the openocd server by flashing the code to it and not having exit statement

Code: Select all

raja@raja-IdeaPad-Gaming-3-15IMH05:~/esp32DevelopmentToolChain/esp-idf/projects/EnergyMeter$ openocd -f interface/jlink.cfg -f board/esp-wroom-32.cfg -c "program_esp32 build/EnergyMeter.bin 0x10000 verify"Open On-Chip Debugger  v0.10.0-esp32-20210902 (2021-09-02-09:38)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
WARNING: boards/esp-wroom-32.cfg is deprecated, and may be removed in a future release.
WARNING: Function (program_esp32) is deprecated, and may be removed in a future release.
         Use (program_esp) instead.
Info : J-Link V9 compiled May  7 2021 16:26:12
Info : Hardware version: 9.70
Info : VTarget = 3.311 V
Info : clock speed 1000 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.cpu0: Target halted, PC=0x40000400, debug_reason=00000001
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : Listening on port 3333 for gdb connections
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.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 35 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 95 KB
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 35 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 95 KB
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu1.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu1.flash' size 4096 KB
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : PROF: Data transferred in 4794.48 ms @ 39.2117 KB/s
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
** Programming Finished **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
** Verified OK **
Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 35 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 95 KB
Info : Using flash bank 'esp32.cpu0.irom' size 96 KB
Info : esp32.cpu0: Target halted, PC=0x400928DA, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 35 KB
Info : Flash mapping 1: 0x20020 -> 0x400d0020, 95 KB
Info : Using flash bank 'esp32.cpu0.drom' size 36 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : negative reply, retrying
Error: Too large number of threads 3261657114!
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.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x400D8C5F, debug_reason=00000001
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x4000C050, debug_reason=00000000
Image

It is to be noted that having exit in the flash command -c "program_esp32 .... verify exit" will flash the the chip but will exit the telnet!

It has to be avoided if you want to start a gdb session.

Thirdly, I started the gdbgui by

Code: Select all

idf.py gdbgui
Screenshot from 2021-11-18 13-57-36.png
Screenshot from 2021-11-18 13-57-36.png (398.79 KiB) Viewed 5921 times
This worked like a charm.

I hope to replicate the same in eclipse configuration. I think I will succeed.
Attachments
Screenshot from 2021-11-18 13-57-43.png
Screenshot from 2021-11-18 13-57-43.png (367.66 KiB) Viewed 5921 times

CKiamy
Posts: 19
Joined: Wed Nov 23, 2022 3:01 pm

Re: Unable to connect J-Link JTAG to ESP32

Postby CKiamy » Fri Dec 23, 2022 1:49 pm

Did you succeeded with eclipse? Did you have to change something?

Who is online

Users browsing this forum: Maksim, MicroController and 151 guests