Skip to content

Restart in bootmode via software not work when USB cable connected directly to PC #10204

Closed
@rafaelgerges

Description

@rafaelgerges

Board

ESP32-S3-WROOM-1-N16R8

Device Description

Plain module ESP32-S3-WROOM-1-N16R8 in a custom PCB.

Hardware Configuration

GPIO 19 and 20 are connected to a host USB (PC or USB HUB).

ESP32-S3 WROOM is power by a external source (not USB powered).

Version

Arduino v2.0.14 and v2.0.17

IDE Name

PlatformIO

Operating System

Windows 10

Flash frequency

40 Mhz

PSRAM enabled

yes

Upload speed

115200

Description

I am trying to restart the ESP32-S3 in download mode via a command in the firmware. I am using the internal PHY (pins 19 and 20) for CDC communication using the tinyUSB library through the 'USBCDC' class.

I am executing the following command and experiencing two different behaviors.

usb_persist_restart(RESTART_BOOTLOADER);
  • When the ESP32-S3 is directly connected to my computer's USB port, it fails to restart and gets stuck, eventually sending a timeout message.
  • When the ESP32-S3 is connected to a USB hub, it restarts correctly and enters download mode.

Sketch

#include <Arduino.h>

void setup()
{
    // A API do USB CDC deve ser iniciado antes do USB
  USBCDC USBSerial;
  // Instância as características do USB
  USB.VID(0x303a);
  USB.PID(0x303a);
  USB.usbClass(0x02);
  USB.usbSubClass(0x02);
  USB.usbProtocol(0x00);
  USB.begin();

  delay(2000);
  usb_persist_restart(RESTART_BOOTLOADER);
}

void loop()
{  
  while(true)
  {
    delay(1000);
  }
}

Debug Message

When the ESP32-S3 is connect diretly to the PC it shows theses menssages:

- [  9625][E][esp32-hal-tinyusb.c:452] usb_switch_to_cdc_jtag(): reset_sem timeout

This problem occurs on esp32-hal-tinyusb.c on usb_switch_to_cdc_jtag method. For some reason it don't get into this method esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, 0, hw_cdc_reset_handler, reset_sem, &intr_handle).

17:24:08.131 -> ESP-ROM:esp32s3-20210327
17:24:08.166 -> Build:Mar 27 2021
17:24:08.166 -> rst:0x1 (POWERON),boot:0x8 (SPI_FAST_FLASH_BOOT)
17:24:08.166 -> SPIWP:0xee
17:24:08.166 -> mode:DIO, clock div:1
17:24:08.166 -> load:0x3fce3808,len:0x44c
17:24:08.166 -> load:0x403c9700,len:0xbd8
17:24:08.166 -> load:0x403cc700,len:0x2a80
17:24:08.166 -> entry 0x403c98d0
17:24:11.245 -> �������ESP-ROM:esp32s3-20210327
17:24:11.245 -> Build:Mar 27 2021
17:24:11.281 -> rst:0xc (RTC_SW_CPU_RST),boot:0x0 (DOWNLOAD(USB/UART0))
17:24:11.281 -> Saved PC:0x4202c4f2
17:24:11.281 -> waiting for download
17:24:11.390 -> Guru Meditation Error: Core 0 panic'ed (LoadProhibited)
17:24:11.390 -> Core 0 register dump:
17:24:11.390 -> PC      : 0x400511b1  PS      : 0x00060330  A0      : 0x80049188  A1      : 0x3fceb640
17:24:11.390 -> A2      : 0x00000000  A3      : 0x3ff1e3fb  A4      : 0x00000001  A5      : 0x00000000
17:24:11.390 -> A6      : 0x00000000  A7      : 0x00000088  A8      : 0x800533dc  A9      : 0x3fceb620
17:24:11.390 -> A10     : 0xfffffffb  A11     : 0x3fceeebc  A12     : 0x3fceefbc  A13     : 0x00000000
17:24:11.390 -> A14     : 0x00000000  A15     : 0x00000006  SAR     : 0x0000000f  EXCCAUSE: 0x0000001c
17:24:11.390 -> EXCVADDR: 0x00000000  LBEG    : 0x400570e8  LEND    : 0x400570f3  LCOUNT  : 0x00000000
17:24:11.390 -> 
17:24:11.390 -> Backtrace: 0x400511b1:0x3fceb640 0x40049185:0x3fceb670 0x400491e5:0x3fceb690 0x40043917:0x3fceb6b0 0x4004392a:0x3fceb6d0 0x40043c33:0x3fceb6f0 0x40034c45:0x3fceb710
17:24:11.390 ->

Other Steps to Reproduce

To reproduce this issue you will need a USB HUB.

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions