我在初始化的时候遇到了相同的情况,结果是下面注释掉的那一行非法访问RXFIFO引起的:
USB_OTG_CoreInitHost()
/* Flush out any leftover queued requests. */ num_channels = pdev->cfg.host_channels; for (i = 0; i < num_channels; i++)
{ USB_OTG_HCGINTMSK_TypeDef hcintmsk; hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS->HCCHAR); hcchar.b.chen = 0; hcchar.b.chdis = 1; hcchar.b.epdir = 0; USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS->HCCHAR, hcchar.d32);
hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS->HCCHAR); hcchar.b.chen = 1; hcchar.b.chdis = 1; hcchar.b.epdir = 0; USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS->HCCHAR, hcchar.d32);
do { //USB_OTG_READ_REG32(&pdev->regs.GREGS->GRXSTSP); hcchar.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS->HCCHAR); USB_OTG_BSP_mDelay (20); }
while (hcchar.b.chen);
hcintmsk.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS->HCGINTMSK); hcintmsk.b.chhltd = 0; USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS->HCGINTMSK , hcintmsk.d32);
/* Clear all pending HC Interrupts */ USB_OTG_WRITE_REG32( &pdev->regs.HC_REGS->HCINT, 0xFFFFFFFF );
|