File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -115,9 +115,6 @@ static void usb_device_task(void *param) {
115115void TinyUSB_Port_InitDevice (uint8_t rhport) {
116116 (void )rhport;
117117
118- REG_CLR_BIT (RTC_CNTL_USB_CONF_REG, RTC_CNTL_IO_MUX_RESET_DISABLE);
119- REG_CLR_BIT (RTC_CNTL_USB_CONF_REG, RTC_CNTL_USB_RESET_DISABLE);
120-
121118 // Reset USB module
122119 periph_module_reset (PERIPH_USB_MODULE);
123120 periph_module_enable (PERIPH_USB_MODULE);
@@ -126,6 +123,10 @@ void TinyUSB_Port_InitDevice(uint8_t rhport) {
126123 usb_hal_init (&hal);
127124 configure_pins (&hal);
128125
126+ // reset core, should be in dcd_esp32sx.c (do that later with more proper testing)
127+ USB0.grstctl |= USB_CSFTRST;
128+ while ((USB0.grstctl & USB_CSFTRST) == USB_CSFTRST) {}
129+
129130 tusb_init ();
130131
131132 // Create a task for tinyusb device stack
@@ -136,8 +137,9 @@ void TinyUSB_Port_InitDevice(uint8_t rhport) {
136137void TinyUSB_Port_EnterDFU (void ) {
137138 // Reset to Bootloader
138139
139- periph_module_reset (PERIPH_USB_MODULE);
140- periph_module_enable (PERIPH_USB_MODULE);
140+ // Reset USB Core
141+ USB0.grstctl |= USB_CSFTRST;
142+ while ((USB0.grstctl & USB_CSFTRST) == USB_CSFTRST) {}
141143
142144 REG_WRITE (RTC_CNTL_OPTION1_REG, RTC_CNTL_FORCE_DOWNLOAD_BOOT);
143145 esp_restart ();
You can’t perform that action at this time.
0 commit comments