ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Понедельник
25 ноября
194428 Топик полностью
Гудвин, волшебник (17.05.2010 18:53, просмотров: 144) ответил =MIV= на Т.е. если я правильно понял то gUSBConnected взводится.
На всякий случай вот то, что у меня работает: void Host_Init (void) { USB_INT32U HostBaseAddr; SC->PCONP |= (1UL<<31); USB->OTGClkCtrl = 0x0000001F; while ((USB->OTGClkSt & 0x0000001F) == 0) { /* Host clock is available */ ; } USB->OTGStCtrl = 0x3; /* P1[18] = USB_UP_LED, 01 */ /* P1[19] = /USB_PPWR, 10 */ /* P1[22] = USB_PWRD, 10 */ /* P1[27] = /USB_OVRCR, 10 */ //oleg закомментарил 2 строчки ниже // PINCON->PINSEL3 &= ~((3<<4) | (3<<6) | (3<<12) | (3<<22)); // PINCON->PINSEL3 |= ((1<<4)|(2<<6) | (2<<12) | (2<<22)); // 0x00802080 /* P0[29] = USB_D+, 01 */ /* P0[30] = USB_D-, 01 */ PINCON->PINSEL1 &= ~((3<<26) | (3<<28)); PINCON->PINSEL1 |= ((1<<26)|(1<<28)); // 0x14000000 PRINT_Log("Initializing Host Stack\n"); // For chip revision V01 and later HostBaseAddr = 0x20080000; Hcca = (volatile HCCA *)(HostBaseAddr+0x000); TDHead = (volatile HCTD *)(HostBaseAddr+0x100); TDTail = (volatile HCTD *)(HostBaseAddr+0x110); EDCtrl = (volatile HCED *)(HostBaseAddr+0x120); EDBulkIn = (volatile HCED *)(HostBaseAddr+0x130); EDBulkOut = (volatile HCED *)(HostBaseAddr+0x140); TDBuffer = (volatile USB_INT08U *)(HostBaseAddr+0x150); // FATBuffer = (volatile USB_INT08U *)(HostBaseAddr+0x1D0); // UserBuffer = (volatile USB_INT08U *)(HostBaseAddr+0x1000); /* Initialize all the TDs, EDs and HCCA to 0 */ Host_EDInit(EDCtrl); Host_EDInit(EDBulkIn); Host_EDInit(EDBulkOut); Host_TDInit(TDHead); Host_TDInit(TDTail); Host_HCCAInit(Hcca); Host_DelayMS(50); /* Wait 50 ms before apply reset */ USB->HcControl = 0; /* HARDWARE RESET */ USB->HcControlHeadED = 0; /* Initialize Control list head to Zero */ USB->HcBulkHeadED = 0; /* Initialize Bulk list head to Zero */ /* SOFTWARE RESET */ USB->HcCommandStatus = OR_CMD_STATUS_HCR; USB->HcFmInterval = DEFAULT_FMINTERVAL; /* Write Fm Interval and Largest Data Packet Counter */ /* Put HC in operational state */ USB->HcControl = (USB->HcControl & (~OR_CONTROL_HCFS)) | OR_CONTROL_HC_OPER; USB->HcRhStatus = OR_RH_STATUS_LPSC; /* Set Global Power */ USB->HcHCCA = (USB_INT32U)Hcca; USB->HcInterruptStatus |= USB->HcInterruptStatus; /* Clear Interrrupt Status */ USB->HcInterruptEnable = OR_INTR_ENABLE_MIE | OR_INTR_ENABLE_WDH | OR_INTR_ENABLE_RHSC; /* Enable the USB Interrupt */ NVIC_EnableIRQ(USB_IRQn); /* enable USB interrupt */ NVIC_SetPriority (USB_IRQn, 0); /* highest priority */ PRINT_Log("Host Initialized\n"); }