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 ?