Need help with JTAG on ESP-WROVER-KIT-VE

Kampino
Posts: 7
Joined: Fri Jan 08, 2021 12:19 pm

Need help with JTAG on ESP-WROVER-KIT-VE

Postby Kampino » Tue Sep 28, 2021 8:51 am

Hi,

I try to use the JTAG debugger on my ESP-WROVER-KIT-VE in an Arduino and the esp-idf environment with Visual Studio Code and PlatformIO. I wrote a small program to test the debugger:

Code: Select all

static void applicationTask(void* p_Parameter)
{
    setup();
    while(true)
    {

        TIMERG0.wdt_wprotect = TIMG_WDT_WKEY_VALUE;
        TIMERG0.wdt_feed = 1;
        TIMERG0.wdt_wprotect = 0;
        micros();
        loop();
    }
}

static void StartApplication(void)
{
    initArduino();
    applicationHandle = xTaskCreateStaticPinnedToCore(applicationTask, "applicationTask", CONFIG_ARDUINO_LOOP_STACK_SIZE, NULL, 1, applicationStack, &applicationBuffer, CONFIG_ARDUINO_RUNNING_CORE);
    if(applicationHandle == NULL)
    {
    }
}

extern "C" void app_main(void)
{
    StartApplication();
}

#include <Arduino.h>

void setup(void)
{
    Serial.begin(115200);
}

void loop(void)
{
    Serial.print("Hello\n\r");
    delay(1000);
}
And my configuration file:

Code: Select all

[platformio]
src_dir = src

[env]
board = esp-wrover-kit

platform = espressif32@1.12.4
framework = arduino, espidf

board_upload.flash_size = 4MB
board_upload.maximum_size = 4194304
board_build.partitions = other/partitions.csv

upload_speed = 921600
upload_port = COM6

monitor_speed = 115200
monitor_port = COM6
monitor_filters = esp32_exception_decoder

debug_tool = ftdi
debug_init_break = tbreak app_main

platform_packages =
    framework-arduinoespressif32 @ https://github.com/marcovannoord/arduino-esp32.git#idf-release/v4.0
    toolchain-xtensa32@3.80200.200512

[common]
build_flags =

    # ESP32 specific
    -D ARDUINO_ESP32_DEV
    -D BOARD_HAS_PSRAM
    -mfix-esp32-psram-cache-issue

lib_deps_builtin =

lib_deps_external =

[env:debug]
build_type = debug
build_flags =
    ${common.build_flags}
    -D DEBUG
lib_deps =
    ${common.lib_deps_builtin}
    ${common.lib_deps_external}
I set the jumper according to this (https://docs.espressif.com/projects/esp ... r-kit.html) guide to enable JTAG:

JP2:
RXD <-> TXD0
TXD <-> RXD0
MTMS <-> TMS
MTDO <-> TDO
MTDI <-> TDI
MTCK <-> TCK

The board is powered over USB.

I got the following output when PlatformIO starts OpenOCD:

Code: Select all

Reading symbols from D:\ESP32-Dev\.pio\build\debug\firmware.elf...
done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = ftdi
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
none separate
adapter speed: 20000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Info : tcl server disabled
Info : telnet server disabled
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 ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: esp32.cpu0: IR capture error; saw 0x1f 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
2

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.: Success.
What is wrong here? Why does the Debugger not start?

Please note: I have already asked in the PlatformIO forum, but they can´t help me.

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

Re: Need help with JTAG on ESP-WROVER-KIT-VE

Postby ESP_Sprite » Wed Sep 29, 2021 3:05 am

That error message means that there's an issue between the on-board FT2232H chip we use as a JTAG-to-USB adapter and the ESP32. Are you sure that 1. the jumpers are set exactly like the guide illustrates, and 2. the program you uploaded did succesfully flash? Also, you don't happen to have any other FT2232-based devices connected to your PC?

Kampino
Posts: 7
Joined: Fri Jan 08, 2021 12:19 pm

Re: Need help with JTAG on ESP-WROVER-KIT-VE

Postby Kampino » Wed Sep 29, 2021 7:04 am

Hi,

2) I have flashed the application onto the ESP32

Code: Select all

MAC: 3c:61:05:4c:32:18
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 24704 bytes to 14495...

Writing at 0x00001000... (100 %)
Wrote 24704 bytes (14495 compressed) at 0x00001000 in 0.2 seconds (effective 1122.9 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 101...

Writing at 0x00008000... (100 %)
Wrote 3072 bytes (101 compressed) at 0x00008000 in 0.0 seconds (effective 1535.0 kbit/s)...
Hash of data verified.
Compressed 194496 bytes to 104518...

...
Writing at 0x00028000... (100 %)
Wrote 194496 bytes (104518 compressed) at 0x00010000 in 1.9 seconds (effective 824.2 kbit/s)...
Hash of data verified.
And I also can execute the code

Code: Select all

I (1193) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (1199) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (1206) heap_init: At 4008D000 len 00013000 (76 KiB): IRAM
I (1212) cpu_start: Pro cpu start user code
I (1217) spiram: Adding pool of 4096K of external SPI memory to heap allocator
I (1239) spi_flash: detected chip: generic
I (1239) spi_flash: flash io: dio
I (1239) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (1247) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations
�Hello
Hello
Hello
Hello
Hello
Hello
1) Please take a look at the picture of my board setup
Setup.jpg
Setup.jpg (820.77 KiB) Viewed 3906 times
I also try to start the debug mode out of the execution of the application from 1). This result in the following output:

Code: Select all

Info : Auto-detected flash size 4096 KB
Info : Using flash size 4096 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active)    APP_CPU: PC=0x400EA72A 
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 23 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 105 KB
Info : Using flash size 108 KB
Info : Target halted. PRO_CPU: PC=0x400916EE (active)    APP_CPU: PC=0x400EA72A 
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 23 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 105 KB
Info : Using flash size 24 KB
0x400ea72a in esp_pm_impl_waiti () at C:\.platformio\packages\framework-espidf\components\esp32\pm_esp32.c:484
484	    asm("waiti 0");
Loading section .dram0.data, size 0x2138 lma 0x3ffbdb60
Loading section .iram0.vectors, size 0x400 lma 0x40080000
Loading section .iram0.text, size 0xcc00 lma 0x40080400
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)
Error: cpu0: xtensa_write_memory (line 807): DSR (FFFFFFFF) indicates target still busy!
Error: cpu0: xtensa_write_memory (line 807): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error: cpu0: xtensa_write_memory (line 807): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1007). Workaround: increase "set remotetimeout" in GDB
Warn : esp32: Failed writing 4 bytes at address 0x3ff48000, data - 00, 20, 49, 9c, 4c, 00, 00, 00
Error: xtensa_write_uint32_list: error writing to 3ff48000
Warn : esp32_soc_reset xtensa_write_uint32_list (reg_value_pairs_pre) err=-4
4

Warn : keep_alive() was not invoked in the 1000ms timelimit. GDB alive packet not sent! (1004). Workaround: increase "set remotetimeout" in GDB
Error: cpu0: xtensa_read_memory (line 700): DSR (FFFFFFFF) indicates target still busy!
Error: cpu0: xtensa_read_memory (line 700): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error: cpu0: xtensa_read_memory (line 700): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
Warn : cpu0: Failed reading 5848 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 failed (-308)!
Error: Failed to run flasher stub (-308)!
Error: failed erasing sectors 0 to 5
Error: flash_erase returned -308
.pioinit:12: Error in sourced command file:
Error erasing flash with vFlashErase packet

Who is online

Users browsing this forum: No registered users and 84 guests