built-in jtag down after esp_wifi_start

maierkomor
Posts: 18
Joined: Sun Jul 03, 2022 8:35 pm

built-in jtag down after esp_wifi_start

Postby maierkomor » Sat Dec 10, 2022 11:39 am

Is it expected that the built-in jtag goes down after esp_wifi_start is called?
In my software the debugging works fine until that point. I can also step into esp_wifi_start, but going over it without breakpoint breaks the USB jtag connection. Stopping at esp_wifi_start seems to break the timing of the function.

This is when setting a breakpoint on esp_wifi_start:

Code: Select all

(gdb) target extended-remote :3333
Remote debugging using :3333
0x420081c6 in app_main () at ../main/startup.cpp:389
389		while (WaitStartup == 0);
(gdb) break esp_wifi_start
Breakpoint 1 at 0x42096480: file ../main/startup.cpp, line 555.
(gdb) set WaitStartup =1
(gdb) c
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
[esp32s3.cpu0] Target halted, PC=0x42096480, debug_reason=00000001
Set GDB target to 'esp32s3.cpu0'
[esp32s3.cpu1] Target halted, PC=0x40043A40, debug_reason=00000000
[New Thread 1070544848]
[New Thread 1070524092]
[New Thread 1070551216]
[New Thread 1070559892]
[New Thread 1070555096]
[New Thread 1070519636]
[New Thread 1070547256]
[New Thread 1070538432]
[Switching to Thread 1070542952]

Thread 1 "main" hit Breakpoint 1, 0x42096480 in esp_wifi_start ()
    at ../main/startup.cpp:555
555		event_trigger(event_id("init`done"));
(gdb) where
#0  0x42096480 in esp_wifi_start () at ../main/startup.cpp:555
#1  0x42019dea in wifi_start_station (ssid=<optimized out>, 
    pass=<optimized out>) at ../main/wifi.cpp:499
#2  0x42034cb2 in cfg_activate () at ../components/streams/estring.h:71
#3  0x4200827a in app_main () at ../main/startup.cpp:477
#4  0x420e6a16 in main_task (args=0x0)
    at ../idf/idf-esp32/components/freertos/port/port_common.c:141
#5  0x40381948 in vPortTaskWrapper (pxCode=0x420e69c4 <main_task>, 
    pvParameters=0x0)
    at ../idf/idf-esp32/components/freertos/port/xtensa/port.c:131
(gdb) n
xTaskGetCurrentTaskHandle ()
    at ../idf/idf-esp32/components/freertos/tasks.c:4650
4650	    {
(gdb) n
4654	        state = portSET_INTERRUPT_MASK_FROM_ISR();
(gdb) where
#0  xTaskGetCurrentTaskHandle ()
    at ../idf/idf-esp32/components/freertos/tasks.c:4654
#1  0x4209ca5a in current_task_is_wifi_task () at ../main/settings.cpp:595
#2  0x42095d07 in wifi_api_lock () at ../main/settings.cpp:595
#3  0x42095d66 in wifi_init_completed () at ../main/settings.cpp:595
#4  0x42096486 in esp_wifi_start () at ../main/settings.cpp:595
#5  0x42019dea in wifi_start_station (ssid=<optimized out>, 
    pass=<optimized out>) at ../main/wifi.cpp:499
#6  0x42034cb2 in cfg_activate () at ../components/streams/estring.h:71
#7  0x4200827a in app_main () at ../main/startup.cpp:477
#8  0x420e6a16 in main_task (args=0x0)
    at ../idf/idf-esp32/components/freertos/port/port_common.c:141
#9  0x40381948 in vPortTaskWrapper (pxCode=0x420e69c4 <main_task>, 
    pvParameters=0x0)
    at ../idf/idf-esp32/components/freertos/port/xtensa/port.c:131
(gdb) 

When setting a breakpoint right after esp_wifi_start, openocd gives the following output:

Code: Select all

Info : New GDB Connection: 1, Target esp32s3.cpu0, state: halted
Error: FreeRTOS uxTaskNumber seems to be corrupted!
Info : [esp32s3.cpu0] Target halted, PC=0x420081C3, debug_reason=00000000
Info : Set GDB target to 'esp32s3.cpu0'
Info : [esp32s3.cpu1] Target halted, PC=0x40043A40, debug_reason=00000000
Error: FreeRTOS uxTaskNumber seems to be corrupted!
Error: libusb_bulk_write error: LIBUSB_ERROR_IO
Error: libusb_get_string_descriptor_ascii() failed with 'LIBUSB_ERROR_IO'
Error: libusb_get_string_descriptor_ascii() failed with 'LIBUSB_ERROR_IO'
Error: libusb_get_string_descriptor_ascii() failed with 'LIBUSB_ERROR_IO'
Error: libusb_get_string_descriptor_ascii() failed with 'LIBUSB_ERROR_IO'
Error: libusb_get_string_descriptor_ascii() failed with 'LIBUSB_ERROR_IO'
Error: libusb_get_string_descriptor_ascii() failed with 'LIBUSB_ERROR_IO'
Error: esp_usb_jtag: device not found!
Any ideas? Is it possible to use builtin-JTAG with WiFi?

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

Re: built-in jtag down after esp_wifi_start

Postby ESP_Sprite » Sun Dec 11, 2022 1:52 am

It's not really expected, no, but this behaviour used to happen in older versions of ESP-IDF, iirc. I think you can change the primary console over to the USB-serial-JTAG converter in menuconfig, and that should work around the issue.

maierkomor
Posts: 18
Joined: Sun Jul 03, 2022 8:35 pm

Re: built-in jtag down after esp_wifi_start

Postby maierkomor » Mon Dec 12, 2022 9:41 pm

Thanks for this hint. This workaround works.

snutw_
Posts: 36
Joined: Wed Aug 21, 2024 1:48 pm

Re: built-in jtag down after esp_wifi_start

Postby snutw_ » Tue Oct 08, 2024 6:30 am

ESP_Sprite wrote:
Sun Dec 11, 2022 1:52 am
It's not really expected, no, but this behaviour used to happen in older versions of ESP-IDF, iirc. I think you can change the primary console over to the USB-serial-JTAG converter in menuconfig, and that should work around the issue.
Wow, I also had that "Error: FreeRTOS uxTaskNumber seems to be corrupted!" - until changing the primary console over to the USB Serial/JTAG Controller (while the secondary console channel I had previously as USB_SERIAL_JTAG_PORT - which was changed automatically to none, when I changed the primary).
Such an effect did it have? On producing errors: "FreeRTOS uxTaskNumber seems to be corrupted!"

snutw_
Posts: 36
Joined: Wed Aug 21, 2024 1:48 pm

Re: built-in jtag down after esp_wifi_start

Postby snutw_ » Mon Nov 18, 2024 3:29 pm

This happens not only when you start WiFi, but also when you start Bluetooth Mesh with external JTAG (and I think the processor gets stuck) - in this case also until you change the console (or until you just wont use it).

Who is online

Users browsing this forum: No registered users and 249 guests