hello,
I am trying to do usb host lite on lpc2468.
i am using IAR compiler.
i have downloaded the code from NXP website.
it is stucking in Host_EnumDev function at while (!HOST_RhscIntr);
host init function is as follows:
void Host_Init (void)
{
unsigned int reg;
USB_INT32U pinsel;
PCONP |= 0x80000000;
VICIntEnClr = (1 << 22); /* Enable the
USB interrupt source */
USBClkCtrl = 0x0000001F;
while ((USBClkSt & 0x0000001F) == 0) {
;
}
reg=0;
/* Set porOTGStCtrlt func bits so that both U1 and U2 can be hosts. */
OTGStCtrl=0x03;
/* P0[12] =
USB_PPWR2 01 */
pinsel = PINSEL0;
pinsel &= 0xFCFFFFFF;
pinsel |= 0x01000000;
PINSEL0 = pinsel;
/* P0[29] =
USB_D+1 */
/* P0[30] =
USB_D-1 */
/* P0[31] =
USB_D+2 */
pinsel = PINSEL1;
pinsel &= 0x03FFFFFF;
pinsel |= 0x14000000;
PINSEL1 = pinsel;
/* P1[19] =
USB_PPWR1 10 */
/* P1[22] =
USB_PWRD1 10 */
/* P1[27] =
USB_OVRCR1 10 */
/* P1[31] =
USB_OVRCR2 01 */
pinsel = PINSEL3;
pinsel &= 0x3F3FCF3F;
pinsel |= 0x00802080;
PINSEL3 = pinsel;
PRINT_Log("Initializing Host Stack\n");
Hcca = (volatile HCCA *)(HOST_BASE_ADDR+0x000);
TDHead = (volatile HCTD *)(HOST_BASE_ADDR+0x100);
TDTail = (volatile HCTD *)(HOST_BASE_ADDR+0x110);
EDCtrl = (volatile HCED *)(HOST_BASE_ADDR+0x120);
EDBulkIn = (volatile HCED *)(HOST_BASE_ADDR+0x130);
EDBulkOut = (volatile HCED *)(HOST_BASE_ADDR+0x140);
TDBuffer = (volatile USB_INT08U *)(HOST_BASE_ADDR+0x150);
FATBuffer = (volatile USB_INT08U *)(HOST_BASE_ADDR+0x1D0);
UserBuffer = (volatile USB_INT08U *)(HOST_BASE_ADDR+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 */
HcControl = 0; /* HARDWARE
RESET */
HcControlHeadED = 0; /* Initialize
Control list head to Zero */
HcBulkHeadED = 0; /* Initialize
Bulk list head to Zero */
/* SOFTWARE
RESET */
HcCommandStatus = OR_CMD_STATUS_HCR;
pinsel=HcCommandStatus;
HcFmInterval = DEFAULT_FMINTERVAL; /* Write Fm Interval
and Largest Data Packet Counter */
/* Put HC in
operational state */
HcControl = (HcControl & (~OR_CONTROL_HCFS)) | OR_CONTROL_HC_OPER;
pinsel = HcControl;
HcRhStatus = OR_RH_STATUS_LPSC; /* Set Global
Power */
pinsel = HcRhStatus;
HcHCCA = (USB_INT32U)Hcca;
HcInterruptStatus |= HcInterruptStatus; /* Clear
Interrrupt Status */
/* Enable
interrupts */
reg=HcInterruptStatus;
HcInterruptEnable = OR_INTR_ENABLE_MIE |
OR_INTR_ENABLE_WDH |
OR_INTR_ENABLE_RHSC;
reg=HcInterruptEnable;
VICIntSelect &= ~(1 << 22); /* Configure
the ISR handler */
VICVectAddr22 = (USB_INT32U)Host_Isr; /* Set the
vector address */
VICIntEnable = (1 << 22); /* Enable the
USB interrupt source */
PRINT_Log("Host Initialized\n");
}
please can anyone help me regarding this.......
I am very worried abt this.
---------------------------------------
Posted through http://www.EmbeddedRelated.com