Совсем еще новичек в STM32.
Скачал с сайта ST библиотеку с примерами STM32_USB-FS-Device_Lib_V3.4.0 , естественно она подходит для их девкитов, а у меня WaveShare Port107V.
Кварц на нем стоит 25 MHz (написанно на нем 25.0C4Z).
Насколько понимаю, для USB нужна частота 48 MHz. Ее в девкитах от ST делают от кварца в 24 Mhz. Но вот как настраивать clock для USB в моем случае?
The advanced clock controller features 3 PLLs to provide a high degree of flexibility to the
application in the choice of the external crystal or oscillator to run the core and peripherals
at the highest frequency and guarantee the appropriate frequency for the Ethernet and USB
OTG FS. A single 25 MHz crystal can clock the entire system and all peripherals including the
Ethernet and USB OTG FS peripherals. In order to achieve high-quality audio performance,
an audio crystal can be used. In this case, the I2S master clock can generate all standard
sampling frequencies from 8 kHz to 96 kHz with less than 0.5% accuracy. For more details about clock configuration for applications requiring Ethernet, USB OTG FS
and/or I2S (audio), please refer to "Appendix A Applicative block diagrams" in your
connectivity line device datasheet.
The USB OTG FS 48 MHz clock which is derived from the PLL VCO clock (2 ×
PLLCLK), followed by a programmable prescaler (divide by 3 or 2). This selection is
made through the OTGFSPRE bit in the RCC_CFGR register. For proper USB OTG FS
operation, the PLL should be configured to output 72 MHz or 48 MHz.
Как получить 72МГц из 25МГц нарисовано в даташите в Appendix A Application block diagrams...
Далее PLLVCO (2 × PLLCLK)/3 = 2 х 72МГц/3 = 48МГц OTGFSCLK... всё...
"Я не даю готовых решений, я заставляю думать!"(С)