Skip to content

Commit

Permalink
add s3 undefined speed note for racing issue with reset.
Browse files Browse the repository at this point in the history
fix dcd_event_sof() with frame number
  • Loading branch information
hathach committed Jan 20, 2025
1 parent 2109b80 commit 5b32df5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions hw/bsp/espressif/boards/family.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,20 +175,14 @@ bool usb_init(void) {
// maybe we can use USB_OTG_MODE_DEFAULT and switch using dwc2 driver
#if CFG_TUD_ENABLED
.otg_mode = USB_OTG_MODE_DEVICE,
.otg_speed = BOARD_TUD_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
#elif CFG_TUH_ENABLED
.otg_mode = USB_OTG_MODE_HOST,
.otg_speed= BOARD_TUH_RHPORT ? USB_PHY_SPEED_HIGH : USB_PHY_SPEED_FULL,
#endif
// https://github.com/hathach/tinyusb/issues/2943#issuecomment-2601888322
// Set speed to undefined (auto-detect) to avoid timinng/racing issue with S3 with host such as macOS
.otg_speed = USB_PHY_SPEED_UNDEFINED,
};

// OTG IOs config
// const usb_phy_otg_io_conf_t otg_io_conf = USB_PHY_SELF_POWERED_DEVICE(config->vbus_monitor_io);
// if (config->self_powered) {
// phy_conf.otg_io_conf = &otg_io_conf;
// }
// ESP_RETURN_ON_ERROR(usb_new_phy(&phy_conf, &phy_hdl), TAG, "Install USB PHY failed");

usb_new_phy(&phy_conf, &phy_hdl);

return true;
Expand Down
2 changes: 1 addition & 1 deletion src/portable/nxp/khci/dcd_khci.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ void dcd_int_handler(uint8_t rhport)

if (is & USB_ISTAT_SOFTOK_MASK) {
KHCI->ISTAT = USB_ISTAT_SOFTOK_MASK;
dcd_event_bus_signal(rhport, DCD_EVENT_SOF, true);
dcd_event_sof(rhport, tu_u16(KHCI->FRMNUMH, KHCI->FRMNUML), true);
}

if (is & USB_ISTAT_STALL_MASK) {
Expand Down

0 comments on commit 5b32df5

Please sign in to comment.