Merge pull request #3126 from salkinium/fix/phyc_pll

[stm32] Wait until the PHYC PLL is stable
This commit is contained in:
Ha Thach
2025-09-10 17:45:59 +07:00
committed by GitHub
3 changed files with 10 additions and 11 deletions

View File

@ -78,10 +78,16 @@
#include "tusb_debug.h"
//--------------------------------------------------------------------+
// Optional API implemented by application if needed
// API implemented by application if needed
// TODO move to a more obvious place/file
//--------------------------------------------------------------------+
// Get current milliseconds, required by some port/configuration without RTOS
extern uint32_t tusb_time_millis_api(void);
// Delay in milliseconds, use tusb_time_millis_api() by default. required by some port/configuration with no RTOS
extern void tusb_time_delay_ms_api(uint32_t ms);
// flush data cache
TU_ATTR_WEAK extern void tusb_app_dcache_flush(uintptr_t addr, uint32_t data_size);

View File

@ -233,6 +233,9 @@ static inline void dwc2_phy_init(dwc2_regs_t* dwc2, uint8_t hs_phy_type) {
// Enable PLL internal PHY
USB_HS_PHYC->USB_HS_PHYC_PLL |= USB_HS_PHYC_PLL_PLLEN;
// Wait ~2ms until the PLL is ready (there's no RDY bit to query)
tusb_time_delay_ms_api(2);
#else
#endif

View File

@ -170,16 +170,6 @@ bool tusb_deinit(uint8_t rhport);
#endif
//--------------------------------------------------------------------+
// API Implemented by user
//--------------------------------------------------------------------+
// Get current milliseconds, required by some port/configuration without RTOS
uint32_t tusb_time_millis_api(void);
// Delay in milliseconds, use tusb_time_millis_api() by default. required by some port/configuration with no RTOS
void tusb_time_delay_ms_api(uint32_t ms);
#ifdef __cplusplus
}
#endif