lpcware

nxpUSBlib on lpc2387

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Baggiz on Thu Feb 16 02:47:44 MST 2012
Hi,

I am trying to use nxpUSBlib's host function on a lpc2387. I have managed to add the necessary device specific code parts and got it running a bit. The problem I see is strange, on different places in the code it seems that when setting a register and immediately start polling for the setting to apply the code hangs looping forever. The strange thing is if I add debug printouts around the place in question it might start to work! This happens on more than one place. An example taken from OHCI.c function "HcdInitDriver":

OHCI_REG(HostID)->OTGClkCtrl = 0x00000019;/* enable Host clock, OTG clock and AHB clock */
while((OHCI_REG(HostID)->OTGClkSt & 0x00000019)!= 0x00000019)
{
}

This loop will never end unless I do something like:

rprintf( "OHCI_REG=%lXh  %lXh\n", OHCI_REG(HostID), &OHCI_REG(HostID)->OTGClkCtrl ) ;
waitForDataSent() ;

OHCI_REG(HostID)->OTGClkCtrl = 0x00000019;/* enable Host clock, OTG clock and AHB clock */
while((OHCI_REG(HostID)->OTGClkSt & 0x00000019)!= 0x00000019)
{
if ( x < 20 )
{
        x++ ;
rprintf( "OTGClkSt=%lXh\n", (OHCI_REG(HostID)->OTGClkSt & 0x00000019) ) ;
waitForDataSent() ;
}
}

rprintf( "more printouts\n" ) ;
waitForDataSent() ;

The function "waitForDataSent" is used to wait for the uart to finish its output.

Any ideas what could be wrong causing this behaviour? Will the new release add native support for lpc23xx?




Outcomes