Skip to content

Commit

Permalink
Merge pull request #357 from adafruit/more-esp32-touch1200
Browse files Browse the repository at this point in the history
esp32 force dmdp reset
  • Loading branch information
hathach authored Nov 13, 2023
2 parents 80930ba + 1b9a4f2 commit c7865a5
Showing 1 changed file with 10 additions and 4 deletions.
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

0 comments on commit c7865a5

Please sign in to comment.