Skip to content

Commit 7cfb1cb

Browse files
committed
Fix USB on P4 EV
mpconfigport.h can't set a default to override circuitpy_mpconfig.h So, when using the high speed device we need to set two defines. Also, fix warning from IDF about selecting UTMI with high speed.
1 parent 15956af commit 7cfb1cb

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

ports/espressif/boards/espressif_esp32p4_function_ev/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121

2222
// Use the second USB device (numbered 0 and 1)
2323
#define CIRCUITPY_USB_DEVICE_INSTANCE 1
24+
#define CIRCUITPY_USB_DEVICE_HIGH_SPEED (1)
2425

2526
#define CIRCUITPY_USB_HOST_INSTANCE 0

ports/espressif/mpconfigport.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,6 @@ extern portMUX_TYPE background_task_mutex;
6969
#define CIRCUITPY_WIFI_DEFAULT_TX_POWER (20)
7070
#endif
7171

72-
#ifndef CIRCUITPY_USB_DEVICE_HIGH_SPEED
73-
#if defined(CONFIG_IDF_TARGET_ESP32P4) && CIRCUITPY_USB_DEVICE_INSTANCE == 1
74-
#define CIRCUITPY_USB_DEVICE_HIGH_SPEED (1)
75-
#else
76-
#define CIRCUITPY_USB_DEVICE_HIGH_SPEED (0)
77-
#endif
78-
#endif
79-
8072
#ifndef CIRCUITPY_ESP32P4_SWAP_LSFS
8173
#define CIRCUITPY_ESP32P4_SWAP_LSFS (0)
8274
#endif

ports/espressif/supervisor/usb.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ void init_usb_hardware(void) {
6666
// Configure USB PHY
6767
usb_phy_config_t phy_conf = {
6868
.controller = USB_PHY_CTRL_OTG,
69+
#if defined(CONFIG_IDF_TARGET_ESP32P4) && CIRCUITPY_USB_DEVICE_INSTANCE == 1
70+
.target = USB_PHY_TARGET_UTMI,
71+
#else
6972
.target = USB_PHY_TARGET_INT,
73+
#endif
7074
.otg_mode = USB_OTG_MODE_DEVICE,
7175
#if defined(CONFIG_IDF_TARGET_ESP32P4) && CIRCUITPY_USB_DEVICE_INSTANCE == 0
7276
.otg_speed = USB_PHY_SPEED_FULL,

0 commit comments

Comments
 (0)