Skip to content

Commit 5b32df5

Browse files
committed
add s3 undefined speed note for racing issue with reset.
fix dcd_event_sof() with frame number
1 parent 2109b80 commit 5b32df5

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

hw/bsp/espressif/boards/family.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,14 @@ bool usb_init(void) {
175175
// maybe we can use USB_OTG_MODE_DEFAULT and switch using dwc2 driver
176176
#if CFG_TUD_ENABLED
177177
.otg_mode = USB_OTG_MODE_DEVICE,
178-
.otg_speed = BOARD_TUD_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
179178
#elif CFG_TUH_ENABLED
180179
.otg_mode = USB_OTG_MODE_HOST,
181-
.otg_speed= BOARD_TUH_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
182180
#endif
181+
// https://github.com/hathach/tinyusb/issues/2943#issuecomment-2601888322
182+
// Set speed to undefined (auto-detect) to avoid timinng/racing issue with S3 with host such as macOS
183+
.otg_speed = USB_PHY_SPEED_UNDEFINED,
183184
};
184185

185-
// OTG IOs config
186-
// const usb_phy_otg_io_conf_t otg_io_conf = USB_PHY_SELF_POWERED_DEVICE(config->vbus_monitor_io);
187-
// if (config->self_powered) {
188-
// phy_conf.otg_io_conf = &otg_io_conf;
189-
// }
190-
// ESP_RETURN_ON_ERROR(usb_new_phy(&phy_conf, &phy_hdl), TAG, "Install USB PHY failed");
191-
192186
usb_new_phy(&phy_conf, &phy_hdl);
193187

194188
return true;

src/portable/nxp/khci/dcd_khci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ void dcd_int_handler(uint8_t rhport)
565565

566566
if (is & USB_ISTAT_SOFTOK_MASK) {
567567
KHCI->ISTAT = USB_ISTAT_SOFTOK_MASK;
568-
dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true);
568+
dcd_event_sof(rhport, tu_u16(KHCI->FRMNUMH, KHCI->FRMNUML), true);
569569
}
570570

571571
if (is & USB_ISTAT_STALL_MASK) {

0 commit comments

Comments
 (0)