Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 

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 and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
ESP32 debugging using ESP-PROG - config issue? (apologies - long post) (Read 226 times)
Techlobo
Newbies
*
Offline



Posts: 9
ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Sep 16th, 2022 at 7:14pm
 
Sorry I don't know whether this fits in 'Installation & Troubleshooting' or 'Hardware Debugging (GDB, GDB WiFi, GDB Stub)'.

I've just started getting back into microelectronics and have started a project using a ESP32-WROOM-32D (ESP32-DevKitC V4) board. I've been playing with Arduino and decided that it would be better to get an IDE that supported hardware debugging (of which I have purchased the ESP-PROG and Jlink EDU hardware probes) so started evaluating Visual Micro and PlatformIO.

I like the simpler setup of Visual Micro but am experiencing some strange issues with the ESP-PROG, and currently am unable to get the Jlink EDU working within the IDE at all (although it does communicate fine via J-Link Commander). For now I would like to concentrate on the ESP-PROG, and I can debug the Jlink issue as a separate topic once I can see that the IDE / ESP-PROG work relatively seamlessly.

My issue with the ESP-PROG is that when I power up the ESP32 / ESP-PROG, start the Visual Micro IDE and then try to 'Start' the build/upload/debug process (using the green Start button) the upload process fails with a fatal error: Timed out waiting for packet content.

If I try to just 'Build and Upload' (using the small arrow button) I get the same problem.
However if I power off the ESP-PROG the 'Build and Upload' works fine.

If I power the ESP-PROG back on and try and start Debug (using the green 'Start' button) the upload again fails.

I then close Visual Micro and start PlatformIO (different script being uploaded to ensure that I know that the board is working for the IDE). With the ESP-PROG powered on the upload process fails. Switch the ESP-PROG off and rerun the upload process and it succeeds. Switch the ESP-PROG back on and run the Debug process (Start debugging button, or F5) and debugging works successfully.

If I now close PlatformIO and switch back to Visual Micro I can now 'Start' the build/upload/debug process of the original script (using the green Start button), and this works successfully i.e. debugging now operates.

If I power cycle the ESP-PROG at this stage I have to go through this process again in order to get hardware debugging working - its almost as if something in the Debug process on PlaformIO is setting something on the ESP-PROG, which then enables it to work with Visual Micro.

------------------------------------------------------

I then tried another approach to see if upload would work OK with the ESP-PROG by selecting 'ESP32 PROG' as the programmer instead of the USB ('No programmer') route. It hung for some time during the upload process and then failed with an Error: xtensa_poll: Target failure. This can be speeded up by pressing the 'Boot' and 'En' buttons on the ESP32.

However I then found that if I switched the programmer back from 'ESP32 PROG' to 'No programmer' and then again used 'Start' (green arrow button) to run the build/upload/debug process - then this time it works sucessfully and the debugging session works as expected.

Changes can then be made to the sample code, uploaded and debugged until the ESP-PROG is again power cycled, at which point this process has to be undertaken again.

The sample scripts being used are very simple currently.

This does not seem a very reliable process for debugging however, and I can't decide if I have a configuration issue, whether I am expecting the wrong approach to the debug process, or what.

I believe that the JTAG wiring / connectivity is OK as the debugger operates as expected once I've gone through the above rigamarole.

I thought it may be a selected board issue (i.e in PlatformIO it uses the ESP-WROOM-02 board) until I discovered the way to make it work purely within Visual Micro - now I don't know. I have been using the 'ESP32 Dev Module' board selection, but did try some others to see if it made any difference - it didn't appear to!

I have a number of output files from the first approach (above the dotted line) but didn't want to attach them until I had a better idea of what approach I should be using - as I didn't want to bombard you with unneccessary data.

I'm awaiting delivery of another ESP32 dev board to see if it makes any difference, but its strange that this one works OK provided that I repeat the above steps.

For extra info the board also performs the same via the Arduino IDE (1.8.16) from a programming perspective.

Sorry for the long post - but do you have any advice?
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #1 - Sep 16th, 2022 at 7:43pm
 
Thanks for the report.

It should be as straightforward as shown on the ESP32 and GDB Page:
https://www.visualmicro.com/page/ESP32-Debugging.aspx

You will need to install the WinUSB Driver for Interface0 of the ESP-PROG using the Zadig tool:
(Note: You will need to do this for the JLINK device as well, without more advanced configuration to use the JLink native drivers)
https://www.visualmicro.com/page/Zadig-Driver-Installation-Guide.aspx

Can you enable the below options:
  • vMicro > Compiler > Verbose
  • vMicro > Compiler > Show Build Properties
  • vMicro > Uploader > Verbose


And perform a build and upload using the ESP-PROG and attach the full Output > Micro Build content as a text file?

If you power cycle the ESP32 + ESP-PROG (so both fully off), and reconnect them to the PC does this improve the situation?

Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #2 - Sep 17th, 2022 at 6:00am
 
Yeah I would like it to be as straightforward as that, but thats not what I am experiencing currently.

I assume that I should just be able to start everything up and use the green 'Start' arrow button to get everything underway?

I had used Zadig to change the WinUSB driver for Interface0 of the ESP-PROG (Note - also for the Jlink EDU, but we will address that separately once I get the ESP-PROG working correctly / reliably).

I performed the following steps from a fresh start - PC restarted, ESP-PROG and ESP32 switched on. I used the 2nd approach for brevity:

Step1 - selected 'No Programmer (Default)' and tried to upload the simple Blink sketch using the green 'Start' arrow button. Failed with 'A fatal error occurred: Timed out waiting for packet content'.

Step2 - selected 'ESP32 PROG' as programmer and again tried to upload sketch using green 'Start' button. Failed after a period with various errors, but the first one was 'Error: timed out while waiting for target halted / 4 - 2'.

Step3 - reselected 'No Programmer (Default)' and again used green 'Start' button to upload sketch. Succeeded this time and went into debug mode from which I could single step, stop and upload minor changes, etc.

I have attached verbose outputs as requested.

Thanks for your time.
Back to top
 

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



Posts: 1459
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #3 - Sep 20th, 2022 at 5:39pm
 
Thanks for the update on this.

Can you confirm if in Step 1+3 you are using a USB lead direct to the target ESP32, or are you using the ESP-PROG's Serial interface?
Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #4 - Sep 22nd, 2022 at 1:26pm
 
Sorry I was away for a couple of days.

The USB lead was connected directly to the ESP32.
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #5 - Sep 22nd, 2022 at 4:32pm
 
Thanks for confirming.

If we just stick with the USB upload to the ESP32, is it reliable every time (using the vMicro Build and Upload button) when the ESP-PROG is disconnected?

Does this then change when the ESP-PROG is connected?
Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #6 - Sep 23rd, 2022 at 5:31pm
 
Yes, and yes.
Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #7 - Sep 23rd, 2022 at 5:34pm
 
I've got another ESP32 now - but with this one I have to press the Boot button on the MCU to get it to program. Other than that it acts the same from an ESP-PROG perspective.

Trying the Jlink at the moment - if I can get that working it may provide some additional data.
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 1459
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #8 - Sep 26th, 2022 at 3:56pm
 
Thanks for the update.

Can you confirm which I/O  pins you are using in your sketch?

If you add a local board.txt to your project, and paste in the below contents, does this improve the ESP-PROG upload/debug?
Code:
debug.toolingsystem=gdbscript
# Most stable OpenOCD Version for newer ESP32 Boards
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.07.21.path}
tools.openocd.program.path={runtime.tools.openocd-esp32-0.10.1-2021.07.21.path}
tools.openocd.upload.path={runtime.tools.openocd-esp32-0.10.1-2021.07.21.path}

# Ensure Upload Pattern contains adapter speed
tools.openocd.program.pattern="{program.path}/{program.cmd}" {program.verbose} -s "{program.path}/share/openocd/scripts/" -f "interface/{openocddebugger}" -c "adapter_khz 5000" -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} {build.bootloader_addr}"  -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" 

Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #9 - Sep 30th, 2022 at 7:29pm
 
Got the JLInk working using USB upload (No programmer - default) but had to use the following Boards.txt entries to get debugger working reliably:

debug.toolingsystem=gdbscript
# Most stable OpenOCD Version for newer ESP32 Boards
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.07.21.path}

Smiley
Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #10 - Sep 30th, 2022 at 7:30pm
 
Then retried with ESP-PROG and managed to get USB upload, and debug operation using the Board.txt entries that you suggested above.
Back to top
 
 
IP Logged
 
Techlobo
Newbies
*
Offline



Posts: 9
Re: ESP32 debugging using ESP-PROG - config issue? (apologies - long post)
Reply #11 - Sep 30th, 2022 at 7:33pm
 
Unfortunately I tried to replicate the simple test solution / project so that I could more easily compare ESP-PROG and JLink operation, and it lost my solution.

I have noticed that there had been previous threads where the simple ability to clone / copy a project / solution would be added. I think that may  be useful.

I will rebuild this weekend.
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print