From 41f78c13472471eed788000f08a84e64d8be81c3 Mon Sep 17 00:00:00 2001 From: lsita Date: Wed, 29 Jun 2022 17:40:19 +0200 Subject: [PATCH 1/2] Fix tinyusb_driver_install (dangling pointer) (cherry picked from commit db90b512a11479a11275b4f08d5ea35127d9c4c0) --- components/tinyusb/additions/src/tinyusb.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/tinyusb/additions/src/tinyusb.c b/components/tinyusb/additions/src/tinyusb.c index f11429582e..94ff9726da 100644 --- a/components/tinyusb/additions/src/tinyusb.c +++ b/components/tinyusb/additions/src/tinyusb.c @@ -37,16 +37,16 @@ esp_err_t tinyusb_driver_install(const tinyusb_config_t *config) .controller = USB_PHY_CTRL_OTG, .otg_mode = USB_OTG_MODE_DEVICE, }; + usb_phy_gpio_conf_t gpio_conf = { + .vp_io_num = USBPHY_VP_NUM, + .vm_io_num = USBPHY_VM_NUM, + .rcv_io_num = USBPHY_RCV_NUM, + .oen_io_num = USBPHY_OEN_NUM, + .vpo_io_num = USBPHY_VPO_NUM, + .vmo_io_num = USBPHY_VMO_NUM, + }; if (config->external_phy) { phy_conf.target = USB_PHY_TARGET_EXT; - usb_phy_gpio_conf_t gpio_conf = { - .vp_io_num = USBPHY_VP_NUM, - .vm_io_num = USBPHY_VM_NUM, - .rcv_io_num = USBPHY_RCV_NUM, - .oen_io_num = USBPHY_OEN_NUM, - .vpo_io_num = USBPHY_VPO_NUM, - .vmo_io_num = USBPHY_VMO_NUM, - }; phy_conf.gpio_conf = &gpio_conf; } else { phy_conf.target = USB_PHY_TARGET_INT; From 88361bddf2542aab20156416db1e5884ef3b63a5 Mon Sep 17 00:00:00 2001 From: lsita Date: Wed, 6 Jul 2022 14:54:35 +0200 Subject: [PATCH 2/2] USB external PHY pinout set as in Reference Manual Figure 29-3. (cherry picked from commit 9ceff23c6d50b37a9fba4c370cffa1654fedeecd) --- components/soc/esp32s3/include/soc/usb_pins.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/soc/esp32s3/include/soc/usb_pins.h b/components/soc/esp32s3/include/soc/usb_pins.h index c8ad806e08..fb68c49bc9 100644 --- a/components/soc/esp32s3/include/soc/usb_pins.h +++ b/components/soc/esp32s3/include/soc/usb_pins.h @@ -15,11 +15,11 @@ #pragma once /* GPIOs used to connect an external USB PHY */ -#define USBPHY_VP_NUM 33 -#define USBPHY_VM_NUM 34 -#define USBPHY_RCV_NUM 35 -#define USBPHY_OEN_NUM 36 -#define USBPHY_VPO_NUM 37 +#define USBPHY_VP_NUM 42 +#define USBPHY_VM_NUM 41 +#define USBPHY_RCV_NUM 21 +#define USBPHY_OEN_NUM 40 +#define USBPHY_VPO_NUM 39 #define USBPHY_VMO_NUM 38 /* GPIOs corresponding to the pads of the internal USB PHY */