Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) ESP-PROG debugger xtensa_write_memory indicates target still busy (Read 5997 times)
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
ESP-PROG debugger xtensa_write_memory indicates target still busy
Dec 27th, 2021 at 11:13am
Print Post  
Hello,
After many searches online I have decided to ask for help as it has been two days that I am stuck with this issue.
- My board is ESP32 Sparkfun Thing plus 16MB of flash
- the debugger is ESP-PROG

Serial debugger works fine but I cannot make the hardware debugger work. I have done everything explained in the video https://www.youtube.com/watch?v=E6GHjUAB1kY&list=LL&index=1.

I have installed the drivers on interface 0 with zadig-2.7.exe
I have checked many times the connections https://www.visualmicro.com/pics/Debug-Help-ESP32-PROG-ALL-Connections.png (in my case 3V3 is connected)


I get the following errors (see also .txt logs attached)
Code
Select All
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates target still busy!
Error during upload using programmer
The uploader process failed

The uploader process failed
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
The uploader returned an error
# Copy build result to 'Project>Property Pages>Intermediate Directory'
# Destination: file:///C:/Users/Pietro/Documents/Arduino/TEIS/FWA3PAN_NEW_3_4_7_VM/Debug/

Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
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
in procedure 'program'
embedded:startup.tcl:480: Error: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 505
at file "embedded:startup.tcl", line 480
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()
 


What I have already done,
- I have seen that the warning of the usb drivers are common but not to worry about (https://community.platformio.org/t/uploading-sketch-using-jtag-interface-on-esp-...)
- I have updated FDTI drivers
- I have tried to change port
- I have tried with blink led example and I still have the same problem
- I have tried to change board from Sparkfun Esp thing Plus 16MB to ordinary ESP32 4MB development kit
- I have tried with an empty brand new ESP32 16MB
- I have tried to reduce the adapter speed adding the line command adapter_khz 10000 
\interface\ftdi
file minimodule-lowcost.cfg
- I have tried with several speeds down to 2000khz
- I have tried to pressing the boot button while uploading
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #1 - Jan 4th, 2022 at 10:08am
Print Post  
Thanks for the brilliant detail, and the logs.

The error seems to indicate something is interfering with the JTAG lines, can you confirm there is nothing in your code which configures or uses the below pins:
GPIO 12, 13, 14, 15

  
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #2 - Jan 10th, 2022 at 9:35am
Print Post  
Thank you for your reply.
I confirm you that pins 12, 13, 14, 15 are not used.

In my code I use pins: 18, 23, 4, 32 
- Serial pins (RX 3, TX 1) 
- Serial2 pins (RX 16, TX 17)

However the "target still busy error" occurs also if I load the example blink sketch so it is not related to the code I think

Code
Select All
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates target still busy!
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error during upload using programmer
The uploader process failed 

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #3 - Jan 10th, 2022 at 1:43pm
Print Post  
Thanks for the update and detail.

If you connect the EN pin on your board, to the EN pin on the ESP32-PROG (shown as a black wire to the Serial header in the below image), and then re-power the setup, does this help?
https://www.visualmicro.com/pics/Debug-Help-ESP32-PROG-ALL-Connections.png

Also I don't believe you need to press the Boot button during uploads via the programmer.

We do have a later version of OpenOCD being integrated which you can try for uploads if the above doesn't resolve the issue.
  
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #4 - Jan 10th, 2022 at 4:21pm
Print Post  
Yes. The connections are like that .png picture you linked, so the enable pin is connected.
I have tried like you suggested to desolder the wire on the enable pin and then to resolder it and restart the set up. But the error is still there.

I have noticed a few things:
- I can upload the code without errors if I turn the debugger off in vMicro options and yes, there is no need to press any boot button
- if under vMicro → Uploader → hardware programmer I select  "none" the code is actually written on the ESP32 but then the debugger page never opens and instead the error has the form of the pop up windows I attach below, on the other hand if I select "ESP32 PROG" the code is never uploaded on the ESP32
- sometimes the error code changes like the one below:
"Error: JTAG scan chain interrogation failed: all ones", if this happens I unplug and replug the usb and the old errors in the previous posts comes in.

Regarding the new version of OpenOCD, is there a guide I can follow to upload it?

Code
Select All
debug_level: 2
adapter speed: 2000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
****[vMicro]**** Uploading App :Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 2000 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 : Listening on port 3333 for gdb connections
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
Error during upload using programmer
The uploader process failed 

  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #5 - Jan 10th, 2022 at 5:11pm
Print Post  
Thanks for the updates.

Just to clarify the first two points, I read it as  "the upload fails when the programmer is selected"?
(If it is set to none it only uses the Serial upload which avoids the JTAG lines and OpenOCD software)

The debugger selection is only for when Debug > Start Debugging, or Debug > Attach to Process are used, and should have no effect on upload directly.  You can set the Programmer to None, and then the Debug: Hardware and ESP32-PROG options, and then try debugging (this uses the same OpenOCD config and wires to perform debugging). Running this may shed more light on the issue there, and an OpenOCD log will be created in the build folder (as shown here)

When the "Error: JTAG scan chain interrogation failed: all ones" is there an orphaned OpenOCD.exe process running? (killing it may be a quicker work around).   
Normally this indicates a wiring issue though, so interesting this appears sometimes.

Ill put another post on shortly as to how to try the latest OpenOCD version for your setup.



  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #6 - Jan 10th, 2022 at 6:04pm
Print Post  
If you want to try the latest release of OpenOCD:

1) Add a Local Board.txt to the project (vMicro > Add Code > Add Local board.txt)
2) Edit the board.txt file added to the project from above, and replace the contents with the below:
Code
Select All
# Try ESP32 Config on OpenOCD from 2021.11.11
# Programmer + Upload Patterns
tools.openocd.program.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}
tools.openocd.program.pattern="{program.path}/{program.cmd}" {program.verbose} -s "{program.path}/share/openocd/scripts/" -f "interface/{openocddebugger}" -c "adapter_khz 2000" -f "board/{upload.openocdscript}" -c "echo -n {****[vMicro]**** Uploading App :}" -c "telnet_port disabled; program {{runtime.platform.path}/tools/partitions/boot_app0.bin} 0xe000" -c "echo -n {****[vMicro]**** Uploading Bootloader :}" -c "program {{build.path}/{build.project_name}.bootloader.bin} 0x1000"  -c "echo -n {****[vMicro]**** Uploading Sketch :}" -c "program {{build.path}/{build.project_name}.bin} 0x10000"  -c "echo -n {****[vMicro]**** Uploading Partitions :}" -c "program {{build.path}/{build.project_name}.partitions.bin} 0x8000 reset; shutdown"
tools.openocd.upload.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}
tools.openocd.upload.pattern="{upload.path}/{upload.cmd}" {upload.verbose} -s "{upload.path}/share/openocd/scripts/" -f "interface/{openocddebugger}" -c "adapter_khz 2000" -f "board/{upload.openocdscript}" -c "echo -n {****[vMicro]**** Uploading App :}" -c "telnet_port disabled; program {build.path}/{build.project_name}.bin {upload.binsector} reset; shutdown"
# Debugger Patterns
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}
tools.openocd.debug.args={params.verbose} -l "{{build.path}/{build.project_name}_DebugOpenOCD.log}" -s "{path}/share/openocd/scripts/" -f "{path}/share/openocd/scripts/interface/{build.openocddebugger}" -c "adapter_khz 2000" -c "set ESP32_RTOS none" -f "{path}/share/openocd/scripts/board/{openocdscript}" {initCmd}
 



Try running Debug > Attach Debugger first (to ensure the tool is downloaded, this is expected to fail)

If you then rebuild the project and try the "Upload using Programmer" and "Hardware Debugging Options", they will both now use the latest version of OpenOCD.
  
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #7 - Jan 11th, 2022 at 8:43am
Print Post  
Regarding your first post. Yes, I confirm that serial debugging works like a charm.

When the pop up error appears I have located the OpenOCD log and it seems that it is not giving further info. Full log content below.

Code
Select All
none
adapter speed: 2000 kHz
Info : Configured 2 cores
esp32 interrupt mask on
Error: libusb_open() failed with LIBUSB_ERROR_NOT_SUPPORTED
Info : clock speed 2000 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 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
Info : esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
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 : Target halted. PRO_CPU: PC=0x4008ECBA (active)    APP_CPU: PC=0x4008ED98
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates target still busy!
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an exception!
Error: cpu0: xtensa_write_memory (line 802): DSR (FFFFFFFF) indicates DIR instruction generated an overrun!
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



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() 



When there is "Error: JTAG scan chain interrogation failed: all ones" there isn't any OpenOCD.exe process running. But as I mentioned I can just replug the USB and this error disappears leaving the: "target still busy" error
  
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #8 - Jan 11th, 2022 at 9:56am
Print Post  
Dear Simon adding the latest release of OpenOCD worked on the second time I run the debug. On the first time I got an error about a thread (see below) but the second time after I did a reset of the setup it worked and now I can finally hardware debugging my esp32.

Just for the record this is the error I got in the first place:
Code
Select All
[New Thread 1073444952]
[Switching to thread 1 (Thread 1073528612)]
=thread-selected,id="1"
[New Thread 1073528612]
Loaded 'shared libraries loaded at this time.'. Cannot find or open the symbol file.
The program '' has exited with code 42 (0x2a). 


 
Thank you vey much, it would have been impossible without your help. I hope you can add this solution to the troubleshooting guide so other people on the website that incur in this problem can easily sort it out because for me making the debug work has been quite buggy (if you pass me the joke). The solution was to force the latest release of OpenOCD adding the .txt board as you have clearly explained.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #9 - Jan 11th, 2022 at 10:10am
Print Post  
Thanks for the update, and for persisting with working through this with us.

We will update our software to include the latest OpenOCD for ESP32 soon, and we will update when this is completed so you can remove the board.txt changes after the update.
  
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #10 - Jan 12th, 2022 at 10:58am
Print Post  
Hello, now have I tried to debug but unfortunately. When I thought it was finally working as it should because it actually opened the debug windows I had more problems coming in. I would like to report them:
1) there is big instability, often "I get the error Unable to start debugging. Failed to find thread 1 for break event" error
- if debugging finally start  I get the "frame not in module exception"
I tried to search for solution and I only found this: https://stackoverflow.com/questions/47933932/visual-studio-2017-debug-error-fram... but unfortunately does not solve the problem for me
In this occasion the debugger is just resetting the esp32 all the time, see the console output below
Code
Select All
rst:0x3 (SW_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:1100
ho 0 tail 12 room 4
load:0x40078000,len:12280
ho 0 tail 12 room 4
load:0x40080400,len:3076
entry 0x400805ec
ets Jul 29 2019 12:21:46 


I post a picture of what is happening on my serial monitor, instead on my serial monitor I should see some printed stuff and my code running
- only once I actually managed to debug as it should pressing continue and pause and adding breakpoint, but the previous instability is making the debugger almost impossible to work with as it started as it should only once in 20 times. 
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #11 - Jan 12th, 2022 at 11:22am
Print Post  
I would like to point out that if I manage to randomly pass the "failed to find thread 1 for break event" error, of which I attach the log report I get the visual debugger.

Yes, the visual debugger starts but I cannot press the "Continue" button and the ESP32 is being continuously reset (see above screenshot of COM21). If I press "pause" and then I press  "continue"  I get the "frame not in module exception".

As stated above only once the debug actually started properly and allowed me pause and continue seeing my code on the serial monitor? The problem is that I haven't any idea why on that occasion it worked as it should.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
pietro.teis
Newbies
*
Offline


Posts: 8
Joined: Dec 23rd, 2021
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #12 - Jan 12th, 2022 at 11:31am
Print Post  
So this is the Output message I get when I have the 

"frame not in module exception"

Code
Select All
openocd: Open On-Chip Debugger  v0.10.0-esp32-20211111 (2021-11-10-21:40)
openocd: Licensed under GNU GPL v2
openocd: For bug reports, read
openocd: 	http://openocd.org/doc/doxygen/bugs.html
openocd: debug_level: 2
openocd:
=thread-group-added,id="i1"
GNU gdb (crosstool-NG esp-2021r1) 8.1.0.20180627-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-host_w64-mingw32 --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
=cmd-param-changed,param="remote hardware-watchpoint-limit",value="2"
Register cache flushed.
Make hw breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
=cmd-param-changed,param="pagination",value="off"
0x40000400 in ?? ()
Note: automatically using hardware breakpoints for read-only addresses.
Loaded 'shared libraries loaded at this time.'. Cannot find or open the symbol file.
This debug engine does not support exception conditions. The condition(s) will be ignored.
@"esp32.cpu1: Debug controller was reset.\n"
@"esp32.cpu1: Core was reset.\n"
@"The target is not running when halt was requested, stopping GDB.\n"

Program received signal SIGINT, Interrupt.
0x40000400 in ?? ()
@"esp32.cpu0: target not halted\n"
@"esp32.cpu0: Failed to prepare for resume!\n"
@"target esp32.cpu0 was not halted when resume was requested\n"
@"The target is not running when halt was requested, stopping GDB.\n"

Program received signal SIGINT, Interrupt.
0x40000400 in ?? ()
Debugger was unable to continue the process.

Debugger was unable to continue the process.

This debug engine does not support exception conditions. The condition(s) will be ignored. 

  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #13 - Jan 12th, 2022 at 11:45am
Print Post  
Thanks for the update, and we have also had issues with the "Failed to Find Thread 1" on a standard ESP32 Dev Module.

We will update when we have further progress around this, however at present it seems that this is not usable from your perspective.

An alternative is to use the Serial Debugger in Visual Micro which allows more breakpoints, conditional breakpoints and debugging over WiFi, along with other features such as Custom Charting etc...
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-Walkthrough-Start...
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2174
Joined: Feb 13th, 2019
Re: ESP-PROG debugger xtensa_write_memory indicates target still busy
Reply #14 - Feb 1st, 2022 at 3:20pm
Print Post  
The latest release should now allow this to work sucessfully (21.11.08-19), available from the top of the board below:
https://www.visualmicro.com/forums/YaBB.pl?board=vs_arduino_ext_releases

To try this out you will also need to add a local board.txt to the project, with the below entries:
Code
Select All
debug.toolingsystem=gdbscript
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path} 

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint