Debugging Adafruit ESP32 Feather with J-LINK

Hello

I am currently working on a project where I want to debug the adafruit esp32 feather over JTAG with my J-LINK. I have connected it using the description at https://docs.platformio.org/en/latest/platforms/espressif32.html.
My platform.ini file looks like this:
[env:featheresp32]
platform = espressif32
board = featheresp32
framework = arduino
debug_tool = jlink

I’m getting the error: No J-Link device found. :weary:
But when I test the J-LINK with my STM-32, everything works as expected. It is also detected by the J-LINK software.

Can anyone help me?

Thanks in advance for all comments

My guess is you are on Windows.

The J-Link software uses a proprietary driver to communicate with the J-Link probe. PlatformIO however uses OpenOCD and OpenOCD uses the generic WinUSB/LibUSB drivers to communicate the J-Link probe (also see OpenOCD - SEGGER Wiki).

To switch the driver, use a tool called Zadig:

  • Start Zadig
  • Check Options > List All Devices
  • Select your J-Link from the main drop down menu. Depending on the J-Link version, it’s either just JLink or BULK interface (Interface 2)
  • Click Replace Driver

The result should look like so:

To restore the custom driver, go to the Device Manager, select the J-Link device and remove the driver. Then the J-Link driver will be reinstalled.

2 Likes

your guess is correct :roll_eyes:

I’m gonna try that right now…
Thanks a lot for your quick response!

Now I get following errors:

PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : tcl server disabled
Info : telnet server disabled
Info : J-Link V10 compiled Oct 22 2019 16:28:15
Info : Hardware version: 10.10
Info : VTarget = 3.232 V
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
Info : Reduced speed from 20000 kHz to 15000 kHz (maximum).
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 : accepting 'gdb' connection from pipe
Error: No symbols for FreeRTOS
Error: Target not examined yet


Error: Target not halted
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: error during select: Unknown error
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()
.pioinit:11: Error in sourced command file:
Remote communication error.  Target disconnected.: No error.

How did you wire your feather to the JLink? There seems to a physical problem with JTDO / JTDI if it only sees ones.

And your application also doesn’t use these pins?

no I am testing at the absolute minimum:

#include <Arduino.h>

void setup() {

  // put your setup code here, to run once:

}

void loop() {

  // put your main code here, to run repeatedly:

}

In ESP32 & PIO Unified Debugger - #20 by botofancalin the TRST line was connected to EN, not “RESET” from the JTAG adapter. You might also try to modify the adatper speed to a lower value than 20000khz as seen in ESP32 + J-link debugger does not start - #12 by Yourigh

the speed is now set to 5000

and I made the connections like this:

and i still have the following errors:

PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20190708 (2019-07-08-11:04)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
adapter speed: 5000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : tcl server disabled
Info : telnet server disabled
Info : J-Link V10 compiled Oct 22 2019 16:28:15
Info : Hardware version: 10.10
Info : VTarget = 3.249 V
Info : clock speed 5000 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 : accepting 'gdb' connection from pipe
Error: No symbols for FreeRTOS
Error: Target not examined yet


Error: Target not halted
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.
Error: attempted 'gdb' connection rejected
Error: error during select: Unknown error
Warn : Flash driver of esp32.flash does not support free_driver_priv()
Warn : Flash driver of irom does not support free_driver_priv()
Warn : Flash driver of drom does not support free_driver_priv()
.pioinit:11: Error in sourced command file:
Remote communication error.  Target disconnected.: No error.

Whatever you changed you went from all ones to all zeroes. Can you try different wires? An even lower speed than 5000kHz, like 1000khZ?

3 Likes

I finally got it to work. :heart_eyes:
I made the connections on a Veroboard and now it works perfectly.

Thanks a lot for the great tips :ok_hand:

1 Like