LPCOPEN USB Virtual Serial Device Port Problem

cancel
Showing results for 
Search instead for 
Did you mean: 

LPCOPEN USB Virtual Serial Device Port Problem

177 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by sipel_tp on Fri Oct 18 07:10:12 MST 2013
Hello, I'm using the example of Virtual Serial Device of lpcuslib of LPCOPEN in LPC1788.

The example is made to make the connection with USB port 1. I tried it this way and it works perfectly.

I wanted to make the example work with port2 so I changed the inicialization like is shown below (the PORT1 parts were the original ones and the PORT2 the new ones).

The program seems to work well but the PC is not able to recognize the connection.

Should I change something else? I can't find any problems. The hardware is okay... so I suspect that  I may be missing something...

Thank you very much!

void HAL_USBInit(uint8_t corenum)
{

/* Enable PLL1 for 48MHz output */
Chip_Clock_EnablePLL(SYSCTL_USB_PLL, SYSCTL_PLL_ENABLE);
#if defined(__LPC175X_6X__)
while ((Chip_Clock_GetPLLStatus(SYSCTL_USB_PLL) & SYSCTL_PLL1STS_LOCKED) == 0);
#else
while ((Chip_Clock_GetPLLStatus(SYSCTL_USB_PLL) & SYSCTL_PLLSTS_LOCKED) == 0);
#endif

//PORT1
//Chip_IOCON_PinMux(LPC_IOCON, 0, 29, IOCON_MODE_INACT, IOCON_FUNC1);/* P0.29 D1+, P0.30 D1- */
//Chip_IOCON_PinMux(LPC_IOCON, 0, 30, IOCON_MODE_INACT, IOCON_FUNC1);
//PORT1

//PORT2
Chip_IOCON_PinMux(LPC_IOCON, 0, 31, IOCON_MODE_INACT, IOCON_FUNC1); /* P0.31 D2+, D2- is dedicated pin.  */
//PORT2


#if defined(USB_CAN_BE_HOST)
Chip_IOCON_PinMux(LPC_IOCON, 1, 19, IOCON_MODE_INACT, IOCON_FUNC2);/* USB_Power switch */
#endif

#if defined(USB_CAN_BE_DEVICE)

//PORT2
//Chip_IOCON_PinMux(LPC_IOCON, 0, 14, IOCON_MODE_INACT, IOCON_FUNC3); /* USB_SoftConnect */
Chip_IOCON_PinMux(LPC_IOCON, 1, 30, IOCON_MODE_INACT, IOCON_FUNC2);  /* USB_VBUS */
Chip_IOCON_PinMux(LPC_IOCON, 0, 13, IOCON_MODE_INACT, IOCON_FUNC1);   /* LED */
//PORT2

//PORT1
//Chip_IOCON_PinMux(LPC_IOCON, 2, 9, IOCON_MODE_INACT, IOCON_FUNC1);/* USB_SoftConnect */
//PORT1


#endif

LPC_SYSCTL->PCONP |= (1UL << 31);/* USB PCLK -> enable USB Per.*/

#if defined(USB_CAN_BE_DEVICE)

        //PORT2
LPC_USB->USBClkCtrl = 0x1A;    /* Dev, OTG, AHB clock enable */
while ((LPC_USB->USBClkSt & 0x1A) != 0x1A);


/* Port Select register when USB device is configured. */
LPC_USB->StCtrl = 0x3;
       //PORT2


LPC_USB->USBClkCtrl = 0x12;/* Dev, PortSel, AHB clock enable */
while ((LPC_USB->USBClkSt & 0x12) != 0x12) ;

HAL_Reset(corenum);

#endif
Labels (1)
0 Kudos
0 Replies