博士
最后登录1970-1-1
在线时间 小时
注册时间2016-4-1
|
本帖最后由 东来东往 于 2016-5-20 11:54 编辑
最近在调试USB,发现提供的例程有点问题,USB频率设置的有问题,应该设置为48MHZ,例程例不对,我使用的是STM32F429_439xx,具体如下: 计算公式:/**PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N**/
/** usb: 25/25*336/7=48Mhz**/
/** usb: 25/25*384/8=48Mhz**/
/** usb: 25/25*432/8=48Mhz**/
/** system_stm32f4xx.c**/
/************************* PLL Parameters *************************************/
#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F401xx)
/* PLL_VCO = (HSE_VALUE or HSI_VALUE / PLL_M) * PLL_N */
#define PLL_M 25
#elif defined (STM32F446xx)
#define PLL_M 8
#elif defined (STM32F411xE)
#if defined(USE_HSE_BYPASS)
#define PLL_M 8
#else
#define PLL_M 16
#endif /* USE_HSE_BYPASS */
#endif /* STM32F40_41xxx || STM32F427_437xx || STM32F429_439xx || STM32F401xx */
/* USB OTG FS, SDIO and RNG Clock = PLL_VCO / PLLQ */
#define PLL_Q 8
#if defined(STM32F446xx)
/* PLL division factor for I2S, SAI, SYSTEM and SPDIF: Clock = PLL_VCO / PLLR */
#define PLL_R 7
#endif /* STM32F446xx */
#if defined(STM32F40_41xxx) || defined(STM32F427_437xx) || defined(STM32F429_439xx) || defined(STM32F446xx)
#define PLL_N 384 //360
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 2
#endif /* STM32F40_41xxx || STM32F427_437x || STM32F429_439xx || STM32F446xx */
#if defined(STM32F401xx)
#define PLL_N 336
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 4
#endif /* STM32F401xx */
#if defined(STM32F411xE)
#define PLL_N 400
/* SYSCLK = PLL_VCO / PLL_P */
#define PLL_P 4
#endif /* STM32F411xx */
最后,以后用的例程的同学注意了,再就是在检测USB时一直处于查询状态(USBH_Process(&USB_OTG_Core, &USB_Host)),自己就是卡在这里好长时间,共勉!
|
|