LPC1837 over OM13061 USB Host enumeration fail

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC1837 over OM13061 USB Host enumeration fail

635 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brunoalmeida on Fri Jul 25 17:51:08 MST 2014
Hello LPCXpresso Support,

  I've been working with the sample code from link when i found out a problem. The code present in link is not enumerating a USB MassStorage while in host mode. What we found out about this problem:

  *software/LPCUSBLib/Drivers/USB/Core/HCD/EHCI/EHCI.c:889 - void HcdIrqHandler(uint8_t HostID)

  After intercepting the USB interruption, USB_REG(HostID)->USBINTR_H register have 0x000c0026 and USB_REG(HostID)->USBSTS_H have 0x00008088. At line 893 the operation USB_REG(HostID)->USBSTS_H & t where t = USB_REG(HostID)->USBINTR_H the result is 0, so its not possible to handle the rest of the interruptions (EHC_USBSTS_PortChangeDetect, EHC_USBSTS_UsbAsyncInt, EHC_USBSTS_UsbPeriodInt, EHC_USBSTS_UsbErrorInt, EHC_USBSTS_IntAsyncAdvance) and the program loops infinity in software/LPCUSBLib/Drivers/USB/Core/Host.c:47 void USB_Host_ProcessNextHostState(uint8_t corenum) because  USB_HostState[corenum] is set as HOST_STATE_Unattached.

  We believe that USBSTS_H should have at least EHC_USBSTS_PortChangeDetect set, but we can't figure out why it is not set.

Thanks in advance.  ;-) 
Labels (1)
0 Kudos
Reply
1 Reply

568 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by brunoalmeida on Mon Jul 28 16:54:52 MST 2014
I found something strange...

software/LPCUSBLib/Drivers/USB/Core/HAL/LPC18XX/HAL_LPC18xx.c:115

HAL_USBInit(uint8_t corenum){

(...)

/* Program the controller to be the USB device controller */
USB_REG(corenum)->USBMODE_D =   (0x2 << 0) /*| (1<<4)*//*| (1<<3)*/;
if (corenum == 0) {
/* set OTG transcever in proper state, device is present
   on the port(CCS=1), port enable/disable status change(PES=1). */
LPC_USB0->OTGSC = (1 << 3) | (1 << 0) /*| (1<<16)| (1<<24)| (1<<25)| (1<<26)| (1<<27)| (1<<28)| (1<<29)| (1<<30)*/;
#if (USB_FORCED_FULLSPEED)
LPC_USB0->PORTSC1_D |= (1 << 24);
#endif
}
HAL_Reset(corenum);
(...)
}

According to the documentation ... USBMODE_D is for device mode and flag 0x02 is also for device mode. Should this part of on HAL_USBInit even if the USB is in HOST mode, should be executed ?
0 Kudos
Reply