Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp32 force dmdp reset #357

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions ports/espressif/boards/boards.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,16 @@ static void usb_switch_to_cdc_jtag(void) {
CLEAR_PERI_REG_MASK(USB_SERIAL_JTAG_CONF0_REG, USB_SERIAL_JTAG_USB_PAD_ENABLE);

// Force the host to re-enumerate (BUS_RESET)
// pinMode(USBPHY_DM_NUM, OUTPUT_OPEN_DRAIN);
// pinMode(USBPHY_DP_NUM, OUTPUT_OPEN_DRAIN);
// digitalWrite(USBPHY_DM_NUM, LOW);
// digitalWrite(USBPHY_DP_NUM, LOW);
gpio_config_t dp_dm_conf = {
.pin_bit_mask = (1ULL << USBPHY_DM_NUM) | (1ULL < USBPHY_DP_NUM),
.mode = GPIO_MODE_OUTPUT_OD,
.pull_up_en = GPIO_PULLUP_DISABLE,
.pull_down_en = GPIO_PULLDOWN_DISABLE,
.intr_type = GPIO_INTR_DISABLE
};
gpio_config(&dp_dm_conf);
gpio_set_level((gpio_num_t)USBPHY_DM_NUM, 0);
gpio_set_level((gpio_num_t)USBPHY_DP_NUM, 0);

// Initialize CDC+JTAG ISR to listen for BUS_RESET
usb_phy_ll_int_jtag_enable(&USB_SERIAL_JTAG);
Expand Down
Loading