电表量测:USBD+_2这个PIN的电平,怎么调都拉不起来.
void USB_Init (void) {
OTG_STAT_CTRL=3;
PINSEL0 &= ~0x3C000000; /* P0.29 USB1_D+, P0.30 USB1_D- */ PINSEL0 |= 0x14000000; /* PINSEL1 26.27, 28.29 */
PINSEL1 &= ~0xC0000000; PINSEL1 |= 0x40000000; PINSEL3 &= ~0x30000000; /* P1.18 GoodLink, P1.30 VBus */ PINSEL3 |= 0x20000000; /* PINSEL3 4.5, 28.29 */
/* The SoftConnect pin for LPC2300 on USB_U1 doesn't work for now, make it GPIO and make it low to turn on pull-up on D+. Once it's fixed, make #if 1 and set it as SoftConn Pin. */ #if 0 PINSEL4 &= ~0x000C0000; /* P2.9 USB1 SoftConnect */ PINSEL4 |= 0x000040000; /* PINSEl4 18.19 */ #else //PINSEL4 &= ~0x000C0000; FIO0DIR |= (1 << 14); FIO0CLR = (1 << 14); #endif
// while(1); PCONP |= 0x80000000; /* USB PCLK -> enable USB Per. */
OTG_CLK_CTRL = 0x12; /* Dev clock, AHB clock enable */ while ((OTG_CLK_STAT & 0x12) != 0x12); while(1); VICVectAddr22 = (unsigned long)USB_ISR; /* USB Interrupt -> Vector 22 */ VICVectCntl22 = 0x01; /* USB Interrupt -> Priority 1 */ VICIntEnable = 1 << 22; /* Enable USB Interrupt */
DEV_INT_EN = DEV_STAT_INT; /* Enable Device Status Interrupt */
#if 1 /* Partial Manual Reset since Automatic Bus Reset is not working */ USB_Reset(); USB_SetAddress(0); #endif } |