add s3 undefined speed note for racing issue with reset.

fix dcd_event_sof() with frame number
This commit is contained in:
hathach 2025-01-20 22:47:32 +07:00
parent 2109b801d4
commit 5b32df5abd
No known key found for this signature in database
GPG Key ID: 26FAB84F615C3C52
2 changed files with 4 additions and 10 deletions

View File

@ -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;

View File

@ -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) {