Skip to content

Commit d9e5a6f

Browse files
authored
solves HWSerial initialization
1 parent f3887c2 commit d9e5a6f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cores/esp32/HWCDC.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
#include "esp_intr_alloc.h"
2525
#include "soc/periph_defs.h"
2626
#include "soc/io_mux_reg.h"
27+
#include "soc/usb_serial_jtag_struct.h"
2728
#pragma GCC diagnostic ignored "-Wvolatile"
2829
#include "hal/usb_serial_jtag_ll.h"
29-
#include "hal/usb_phy_ll.h"
3030
#pragma GCC diagnostic warning "-Wvolatile"
3131
#include "rom/ets_sys.h"
3232
#include "driver/usb_serial_jtag.h"
@@ -266,7 +266,14 @@ void HWCDC::begin(unsigned long baud)
266266
}
267267
}
268268
// Configure PHY
269-
usb_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG);
269+
// USB_Serial_JTAG use internal PHY
270+
USB_SERIAL_JTAG.conf0.phy_sel = 0;
271+
// Disable software control USB D+ D- pullup pulldown (Device FS: dp_pullup = 1)
272+
USB_SERIAL_JTAG.conf0.pad_pull_override = 0;
273+
// Enable USB D+ pullup
274+
USB_SERIAL_JTAG.conf0.dp_pullup = 1;
275+
// Enable USB pad function
276+
USB_SERIAL_JTAG.conf0.usb_pad_enable = 1;
270277
usb_serial_jtag_ll_disable_intr_mask(USB_SERIAL_JTAG_LL_INTR_MASK);
271278
usb_serial_jtag_ll_ena_intr_mask(USB_SERIAL_JTAG_INTR_SERIAL_IN_EMPTY | USB_SERIAL_JTAG_INTR_SERIAL_OUT_RECV_PKT | USB_SERIAL_JTAG_INTR_BUS_RESET);
272279
if(!intr_handle && esp_intr_alloc(ETS_USB_SERIAL_JTAG_INTR_SOURCE, 0, hw_cdc_isr_handler, NULL, &intr_handle) != ESP_OK){

0 commit comments

Comments
 (0)