If TinyUSB CDC is enabled, the built-in USB JTAG interface is disabled. When the program crashes, the crash core dump or GDB Stub does not work in this case. Is it possible to configure ESP32S3 to automatically switch back to the USB JTAG interface on crash, so that the ESP32S3 could be easily debugged without using another UART interface?
Thanks
Crash GDBStub over ESP32S3's built-in USB JTAG when TinyUSB CDC is in use
Re: Crash GDBStub over ESP32S3's built-in USB JTAG when TinyUSB CDC is in use
I think this would be a bit difficult for the following reason. After switching to the USB_SERIAL_JTAG, the host would need to re-enumerate the device. However this will require some time. The panic handler code would have to wait for the enumeration to finish, but it's not clear how long we need to wait for that to happen. If the host is not connected (or enumeration doesn't happen for some reason) then we might end up getting stuck in the panic handler.
Besides, the serial port created by the OS for the usb_serial_jtag will not be the same as the one created by the OS for TinyUSB CDC device, so your terminal program will not automatically show you the panic handler output — it will be sent to a different serial port.
I would suggest doing one of the following, instead:
Besides, the serial port created by the OS for the usb_serial_jtag will not be the same as the one created by the OS for TinyUSB CDC device, so your terminal program will not automatically show you the panic handler output — it will be sent to a different serial port.
I would suggest doing one of the following, instead:
- Use the internal PHY for one USB port (e.g. USB_OTG peripheral with tinyusb) and an external USB PHY for another (e.g. USB_SERIAL_JTAG). In the final product, don't populate one of the ports (debugging) on the PCB.
- Use UART for diagnostics and the built-in USB port for the USB functionality with tinyusb.
Re: Crash GDBStub over ESP32S3's built-in USB JTAG when TinyUSB CDC is in use
Thank you for the explanation!ESP_igrr wrote: ↑Thu Oct 20, 2022 12:07 pmI think this would be a bit difficult for the following reason. After switching to the USB_SERIAL_JTAG, the host would need to re-enumerate the device. However this will require some time. The panic handler code would have to wait for the enumeration to finish, but it's not clear how long we need to wait for that to happen. If the host is not connected (or enumeration doesn't happen for some reason) then we might end up getting stuck in the panic handler.
Besides, the serial port created by the OS for the usb_serial_jtag will not be the same as the one created by the OS for TinyUSB CDC device, so your terminal program will not automatically show you the panic handler output — it will be sent to a different serial port.
I would suggest doing one of the following, instead:
- Use the internal PHY for one USB port (e.g. USB_OTG peripheral with tinyusb) and an external USB PHY for another (e.g. USB_SERIAL_JTAG). In the final product, don't populate one of the ports (debugging) on the PCB.
- Use UART for diagnostics and the built-in USB port for the USB functionality with tinyusb.
Who is online
Users browsing this forum: Google [Bot] and 80 guests