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
Normal Topic Getting Frame not in module exception (Read 2201 times)
John2006_ty
Junior Member
**
Offline


Posts: 22
Joined: Aug 7th, 2019
Getting Frame not in module exception
Aug 2nd, 2023 at 4:05pm
Print Post  
I am getting an exception Unhandled as Frame not in module when I try to use ESP32S3-USB as the debugger hardware. 

Project build output is attached. Screen capture of the exception message is also attached as a png file.

I have used Zadig to assign USB JTAG/serial debug unit (Interface 0) to USB CDC, and USB JTAG/serial debug unit (Interface 2) to WinUSB. In my Windows Control Panel, I can see USBJTAG/serial debug unit under Universal Serial Bus devices. This is the only configuration that allows me to flash esp32s3 via the USB port (COM9) and run
Code (C++)
Select All
openocd -f board/esp32s3-builtin.cfg 

under ESP-IDF Powershell to attach JTAG.

What did I miss to use ESP32S3-USB as the hardware debugger?

Please help.
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
John2006_ty
Junior Member
**
Offline


Posts: 22
Joined: Aug 7th, 2019
Re: Getting Frame not in module exception
Reply #1 - Aug 4th, 2023 at 2:47am
Print Post  
Look deeply into the output message I can see the following error:

OpenOCD log looks like below when flash is accessed (e.g. upon GDB connect).

Error: esp_usb_jtag: usb sent only 0 out of 31 bytes.
Error: missing data from bitq interface
Error: esp_usb_jtag: usb sent only 0 out of 50 bytes.
Error: missing data from bitq interface
Error: Failed to exec JTAG queue!
Error: Failed to read debug stubs address location (-104)!


From https://github-wiki-see.page/m/espressif/openocd-esp32/wiki/Troubleshooting-FAQ it states that it is a known issue. The first solution is to use an external JTAG which defeats the purpose of USB JTAG. A second solution is to run OpenOCD with disabled flash support with option -c 'set ESP_FLASH_SIZE 0'.

So, in Local Board.txt I have modified the last syntax as :

vs-cmd.Debug.AttachtoProcess.tools.openocd.initCmd=-c "init; reset halt set ESP_FLASH_SIZE 0".

The problem is not solved, unfortunately. But I wish to make sure my command in the Local Board.txt is correct. 

Any hint?

« Last Edit: Aug 4th, 2023 at 2:49am by John2006_ty »  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: Getting Frame not in module exception
Reply #2 - Aug 4th, 2023 at 10:18am
Print Post  
Thanks for the update and the brilliant detail.

Interestingly in the openocd-esp32-0.10.1-2021.07.21 version of OpenOCD, it appears as though this should already be set in the esp32s3.cfg file (which is referenced by the esp32s3-builtin.cfg supplied on the command line):

Code
Select All
# TODO: remove this when flash support is implemented
if { ![info exists ESP_FLASH_SIZE] } {
	set ESP_FLASH_SIZE "0"
}
 



But to ensure it is set, add this into the command run in vMicro, you can amend your override in board.txt to the first override in the attached file.

An alternative could be to use a newer version of OpenOCD, as it appears the fix is in the openocd-esp32-0.10.1-2021.11.11 version from the tags on the commit.  If you change the  override in your board.txt to the second one in the attached file it will use this newer version of the tools.
  

Please Register or Login to the Forum to see File Attachments
Back to top
IP Logged
 
John2006_ty
Junior Member
**
Offline


Posts: 22
Joined: Aug 7th, 2019
Re: Getting Frame not in module exception
Reply #3 - Aug 4th, 2023 at 3:40pm
Print Post  
Simon@Visual Micro wrote on Aug 4th, 2023 at 10:18am:
alternative could be to use a newer version of OpenOCD


It turns out I need to use both your tactics to get ESP32S3 USB debug works. Please find below my complete board.txt script :

Code (Pascal)
Select All
tools.esps3usb.vmserver.args={params.verbose} -l "{{build.path}/{build.project_name}_DebugOpenOCD.log}" -s "{path}/share/openocd/scripts/" -c "set ESP_FLASH_SIZE 0" -f "{path}/share/openocd/scripts/interface/{build.openocddebugger}" -c "set ESP32_RTOS none" {initCmd}
debug.toolingsystem=gdbscript
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}
vs-cmd.Debug.AttachtoProcess.tools.openocd.initCmd=-c "init; reset halt" 



There is some little experience to share:
1) Although it is possible to use the same builtin USB port as the Serial CDC port for program download and JTAG debug port at the same time with only USB D+/D- lines, the result was not stable for me. VS freezed twice with the most basic arduino hello world program. 
2) As a result, I still need GPIO0 + EN pin with an auto-download circuit and a CP2102 USB-UART bridge for program download before USB JTAG online debug can proceed. This is a bit disappointed to me because most other chips like STM32 need just SWD of 2 wires for both program download and online debug. Why can't ESP32 do the same? This is not a Vmicro issue of course.

On top, before ESP32S3's USB port can be recognized by a PC, I needed to download any program with GPIO0 + EN pin for my fresh ex-factory ESP32 module anyway. That means the CP2102 is not saved.

I am interested to know if there is any performance difference between built-in USB JTAG and an external JTAG (ESP PROG with FTDI chip). I have ordered an ESP PROG to do a test. Still waiting for the courier to arrive. If there is any suggestion on benchmark tool, please let me know.

« Last Edit: Aug 4th, 2023 at 3:44pm by John2006_ty »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Getting Frame not in module exception
Reply #4 - Aug 6th, 2023 at 5:20pm
Print Post  
That will be very useful for all. Thank you for the update. Interested to hear how you get on. we will also test with this info to see if we can improve things too.
  
Back to top
IP Logged
 
John2006_ty
Junior Member
**
Offline


Posts: 22
Joined: Aug 7th, 2019
Re: Getting Frame not in module exception
Reply #5 - Aug 9th, 2023 at 12:50pm
Print Post  
I would like to provide an update to my project. Have got a new ESP PROG JTAG just now with my findings as follow:

1) New ESP PROG JTAG will return two USB Serial Ports (COM12 & COM13) before Zadig to replace one of the serial ports (Interface 0) by WinUSB (Installing Dual RS232-HS WinUSB Driver.jpg).

2) board.txt is exactly the same as that mentioned in Vmicro web site as follows:

Code (CSS)
Select All
debug.toolingsystem=gdbscript
# Very Latest OpenOCD needed for ESP32S3
tools.openocd.debug.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}
tools.openocd.program.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path}
tools.openocd.upload.path={runtime.tools.openocd-esp32-0.10.1-2021.11.11.path} 



3) Need to set at least one breakpoint at any line in source code, otherwise, VS Studio will freeze on pressing with stop or pause icon.

Results:
Debugging procedure was smooth. It is difficult to compare a FTDI JTAG vs bultin-USB debug as there is no benchmark tool.
My impression is that JTAG is a bit faster. However, an external USB-UART bridge (CP2102) with auto-download tool is necessary for FTDI JTAG even though there is a second serial port on it. I can't use it for program download somehow. 

On the other hand, when bultin-USB is used it is possible to use the same USB port for program download. A bonus with bultin USB as the debug port is: only 2 pins are required whereas FTDI JTAG needs 4 pins.

This message concludes my findings comparing FTDI JTAG vs Builtin USB of ESP32S3 as debugging hw.

Thank you.
« Last Edit: Aug 9th, 2023 at 12:51pm by John2006_ty »  

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


Posts: 2695
Joined: Feb 13th, 2019
Re: Getting Frame not in module exception
Reply #6 - Aug 9th, 2023 at 1:04pm
Print Post  
Thanks for the update and good the debugging has worked with the new ESP PROG module.

You should be able to use the second port (Serial Passthrough) on the ESP-PROG to upload to the board, if the relevant wires are connected to the other interface on the ESP-PROG and your ESP32's Serial Pins:
Wiring Diagram: https://www.visualmicro.com/pics/Debug-Help-ESP32-PROG-ALL-Connections.png

We will review the instructions we have on the website, and the patterns we automatically configure for this board (and other newer ESP32 boards) and update with any fixes or changes when they are complete.
  
Back to top
IP Logged
 
John2006_ty
Junior Member
**
Offline


Posts: 22
Joined: Aug 7th, 2019
Re: Getting Frame not in module exception
Reply #7 - Aug 9th, 2023 at 3:19pm
Print Post  
Simon@Visual Micro wrote on Aug 9th, 2023 at 1:04pm:
if the relevant wires are connected to the other interface on the ESP-PROG and your ESP32's Serial Pins


Yes, that works as well. Because there is a CH34x-based USB port with auto download circuit on my ESP32 EVK so the fast lane is to use that port right away.

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