将外部晶振修改为8M之后,打印主频96M,一切正常,但是USB的时钟源是未进行修改,应为我主频没变,时钟配置如下void usb_rcu_config(void)
{
uint32_t system_clock = rcu_clock_freq_get(CK_SYS);
printf("系统时钟为:%d\n", system_clock);
if (48000000U == system_clock) {
usbfs_prescaler = RCU_CKUSB_CKPLL_DIV1;
timer_prescaler = 3U;
} else if (72000000U == system_clock) {
usbfs_prescaler = RCU_CKUSB_CKPLL_DIV1_5;
timer_prescaler = 5U;
printf("系统时钟为:%d\n", system_clock);
} else if (96000000U == system_clock) {
usbfs_prescaler = RCU_CKUSB_CKPLL_DIV2;
timer_prescaler = 7U;
} else {
/* reserved */
}
rcu_usb_clock_config(usbfs_prescaler);
rcu_periph_clock_enable(RCU_USBFS);
}
但是运行至枚举状态机时就卡死在死循环不出来,这是为什么呢
进入case HOST_DEV_ENUM:之后:调用usbh_devdesc_get (uhost, 8U)) -----》》》usbh_ctl_handler (uhost);------》》》
if (URB_DONE == usbh_urb_wait (uhost, uhost->control.pipe_in_num, DATA_STAGE_TIMEOUT)) {
uhost->control.ctl_state = CTL_STATUS_OUT;
}
就卡死在这个等待
|