问答

汇集网友智慧,解决技术难题

mojingjian

TA的家园币:108  

  • LPC1788 usb无法触发批量端点中断

    如题,刚上手LPC1788开发usb功能,做hid设备,在rt-thread的usb框架下参考stm32f4的usb驱动文件实现了hid设备,成功枚举的情况下进行批量传输时,主机显示“Bulkwiritefailed...”(没记全),板子仿真调试下没看到有触发批量端点的中断。请教各位大咖这种问题是什么原因?部分代码:staticstructep_id_ep_pool[]={{0x0,USB_EP_ATTR_CONTROL,USB_DIR_OUT,64,ID_ASSIGNED},{0x1,USB_EP_ATTR_CONTROL,USB_DIR_IN,64,ID_UNASSIGNED},{0x2,USB_EP_ATTR_INT,USB_DIR_OUT,64,ID_UNASSIGNED},{0x3,USB_EP_ATTR_INT,USB_DIR_IN,64,ID_UNASSIGNED},{0x4,USB_EP_ATTR_BULK,USB_DIR_OUT,64,ID_UNASSIGNED},{0x5,USB_EP_ATTR_BULK,USB_DIR_IN,64,ID_UNASSIGNED},{0xFF,USB_EP_ATTR_TYPE_MASK,USB_DIR_MASK,0,ID_ASSIGNED},};staticvoid_usb_hw_init(void){//USB_DEV_CLK_EN,USB_AHB_CLK_EN,USB_OTG_CLK_ENrt_uint32_tulClkCtrl=0x1A;LPC_SC->PCONP|=0x80000000;//给USB控制器提供电源LPC_USB->USBClkCtrl=ulClkCtrl;//配置USB时钟控制寄存器while((LPC_USB->USBClkSt&ulClkCtrl)!=ulClkCtrl);LPC_USB->StCtrl|=0x03;//U1HOST,U2devices//LPC_IOCON->P0_29&=~0x07;//P0.29D1+,P0.30D1-//LPC_IOCON->P0_29|=0x01;//LPC_IOCON->P0_30&=~0x07;//LPC_IOCON->P0_30|=0x01;LPC_IOCON->P0_31&=~0x07;LPC_IOCON->P0_31|=0x01;LPC_IOCON->P0_14&=~0x07;LPC_IOCON->P0_14|=0x01;}staticvoid_usb_inturrupt_init(void){rt_uint32_tintTmp=0x04;//ep_slowLPC_USB->DevIntClr=0x01;//禁止同步传输帧中断LPC_USB->DevIntEn=intTmp;//使能复位中断,低速中断LPC_USB->DevIntPri=0;//使能端点中断为低优先级中断intTmp=(0x01PLL1CFG=0x23;LPC_SC->PLL1CON=0x01;//PLL1EnableLPC_SC->PLL1FEED=0xAA;LPC_SC->PLL1FEED=0x55;while(!(LPC_SC->PLL1STAT&(1