Olimex Support Forum

Microcontrollers => ESP32 => Topic started by: Ruppie on January 20, 2018, 05:07:34 AM

Title: ESP32-EVB, how to connect JTAG Debugger
Post by: Ruppie on January 20, 2018, 05:07:34 AM
I would like to ask how to connect an JTAG debugger ?
I can't find a header to connect a debugger.
Is it possible to konect an debugger to the board
If it is not possible on thos board Revision, please provide on on the next board review



Thanks in Advance
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: JohnS on January 20, 2018, 02:28:43 PM
Looks like you need to use the MTDI, MTDO, MTMS, MTCK signals but some are already used (see schematic).

If so, I think you'd have to disconnect them.

John
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: LubOlimex on January 23, 2018, 09:12:52 AM
For the hardware connection between the JTAG and the ESP32-EVB you can use wires and the extension header EXT1:

Pin #13 - GPIO12/IR_Transmit - MTDI = TDI

Pin #14 - GPIO13/I2C-SDA – MTCK = TCK

Pin #15 - GPIO14/HS2_CLK – MTMS = TMS

Pin #16 - GPIO15/HS2_CMD - MTDO = TDO

Pin #34 - GND

Refer to the schematic for better understanding. Since there is multiplexing with the SD card interface, make sure that any SD card is removed from ESP32-EVB. Once you identify the hardware points for the connection read here: http://esp-idf.readthedocs.io/en/latest/api-guides/jtag-debugging/#jtag-debugging-how-it-works

If you need a compatible OpenOCD debugger, consider our mature and well-known products – ARM-USB-TINY-H and ARM-USB-OCD-H.

Best regards,
Lub/OLIMEX
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: Ruppie on January 24, 2018, 07:31:38 PM
Hello,
i tried to use VISUALGDB for development and got an error message as shown below:
Can someone give an explanaiten what caused this error message and show me some hints to try fixing,please.

C:\SysGCC\esp32\esp32-bsp\OpenOCD\bin\openocd.exe -c "gdb_port 61847" -c "telnet_port 61848" -f interface/ftdi/olimex-arm-usb-tiny-h.cfg -f target/esp32.cfg -c "adapter_khz 3000" -c "echo VisualGDB_OpenOCD_Ready"
Open On-Chip Debugger 0.9.0 (2017-08-05)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
force hard breakpoints
adapter speed: 3000 kHz
VisualGDB_OpenOCD_Ready
Error: no device found
Error: unable to open ftdi device with vid 15ba, pid 002a, description 'Olimex OpenOCD JTAG ARM-USB-TINY-H', serial '*' at bus location '*'


What may cause this error:
What are correct settings of adapter within deice manager, wich driver to use, VisualGDB settings ?

Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: LubOlimex on January 25, 2018, 08:35:37 AM
Your drivers are improper, it seems. Use this VisualGDB tutorial as a basis (and the USBDriverTool that they mention): https://visualgdb.com/tutorials/esp8266/olimex/ - start from point 6.
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: vinifr on July 25, 2018, 05:55:23 PM
hi,

I tried this connections but did not work

Connections ESP32 - ARM-USB-OCD
gpio12 - TTDI
gpio13 - TTCK
gpio14 - TTMS
gpio15 - TTDO
GND    - GND


I used this command with openocd-esp32:
openocd -f interface/ftdi/olimex-arm-usb-ocd-h.cfg -f board/esp-wroom-32.cfg
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: vinifr on July 25, 2018, 07:08:47 PM
Hi,

I now connected JTAG VREF to ESP32 3V3 and something started to work!
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 was reset (pwrstat=0x5F, after clear 0x4F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x4F).
cpu0: Current bits set: BreakIn BreakOut RunStallIn
cpu1: Current bits set: BreakIn BreakOut RunStallIn


But after connect to gdb using: xtensa-esp32-elf-gdb -ex 'target remote localhost:3333' build/evd_esp32.elf I got this:

Info : accepting 'gdb' connection on tcp/3333
Error: Exception reading lcount!

Info : Target halted. PRO_CPU: PC=0x00000000 (active)    APP_CPU: PC=0x00000000
Error: cpu0: xtensa_write_memory (line 759): DSR (00000007) indicates target still busy!
Error: cpu0: xtensa_write_memory (line 759): DSR (00000007) indicates DIR instruction generated an exception!
Warn : esp32: Failed writing 4 bytes at address 0x3FF60064, data - a1, 3a, d8, 50, a1, 3a, d8, 50
embedded:startup.tcl:21: Error:
in procedure 'halt'
in procedure 'ocd_bouncer'
in procedure 'esp_core_halt'
in procedure 'esp32' called at file "/usr/local/share/openocd/scripts/target/esp32.cfg", line 47
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21

Error: cpu0: xtensa_read_memory (line 652): DSR (8000CC13) indicates DIR instruction generated an exception!
Warn : cpu0: Failed reading 5880 bytes at address 0x40090000
Error: no working area available, can't alloc space for stub code!
Error: Failed to load stub (-308)!
Error: Algorithm run faied (-308)!
Error: Faied to run flasher stub (-308)!
Error: Failed to get flash mappings (-308)!
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
Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: JohnS on July 27, 2018, 11:02:13 PM
You may get help from the oocd ML.  They'll need -d3 log.

John
Title: Re: ESP32-EVB, how to connect JTAG Debugger
Post by: LubOlimex on July 30, 2018, 01:18:10 PM
Or the ESP32 forums since they also provide an official guide here: http://esp-idf.readthedocs.io/en/latest/api-guides/jtag-debugging/index.html