mirror of
https://github.com/hathach/tinyusb.git
synced 2026-08-18 11:02:16 +00:00
fix(dwc2_hcd): correct HFIR for Low-Speed devices via internal FS PHY
When a Low-Speed device is connected through the internal FS PHY, the effective PHY clock is 6MHz (HCFG_FSLS_PHYCLK_SEL_6MHZ), but phy_clock was incorrectly left at 48. This caused HFIR to be calculated as 47999 (~8ms SOF interval) instead of the correct 5999 (1ms SOF interval), breaking periodic endpoint scheduling. Fixes: LS mouse only receiving first HID report on OTG_HS + FS PHY
This commit is contained in:
@ -1427,10 +1427,11 @@ static void port0_enable(dwc2_regs_t* dwc2, tusb_speed_t speed) {
|
||||
uint32_t phy_clock;
|
||||
|
||||
if (gusbcfg.phy_sel == GUSBCFG_PHYSEL_FULLSPEED) {
|
||||
phy_clock = 48; // dedicated FS is 48Mhz
|
||||
if (speed == TUSB_SPEED_LOW) {
|
||||
phy_clock = 6; // LS via FS PHY: effective clock is 6MHz
|
||||
hcfg |= HCFG_FSLS_PHYCLK_SEL_6MHZ;
|
||||
} else {
|
||||
phy_clock = 48; // dedicated FS is 48Mhz
|
||||
hcfg |= HCFG_FSLS_PHYCLK_SEL_48MHZ;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user