I have seen couple of folks asking this question, and even this was a question me until I debugged the issue. I have chosen usbd_rom_hid_keyboard example for explaining. This example uses USB0 for demonstrating HID_Keybaord functionality.
To make the same example to work with USB-1, we need the following changes.
1) comment "#define USE_USB0" in app_usbd_cfg.h file
/* #define USE_USB0 */
2) Enable clock for USB-1, I have defined the following function
/**
* @brief enables power for USB1
* @return Nothing
*/
void pwrEnable_USB1(){
/* Setup GPIOs for USB demos */
Chip_SCU_PinMux(0x2, 6, (MD_PUP | MD_EZI), FUNC4); /* P2_6 USB1_PWR_EN, USB1 VBus function */
Chip_SCU_PinMux(0x2, 5, (MD_PLN | MD_EZI | MD_ZI), FUNC2); /* P2_5 USB1_VBUS, MUST CONFIGURE THIS SIGNAL FOR USB1 NORMAL OPERATION */
Chip_GPIO_WriteDirBit(LPC_GPIO_PORT, 5, 6, true); /* GPIO5[6] = USB1_PWR_EN */
Chip_GPIO_WritePortBit(LPC_GPIO_PORT, 5, 6, true); /* GPIO5[6] output high */
}
Call the above function in hid_main
Board_Init();
pwrEnable_USB1();
/* enable clocks and pinmux */
USB_init_pin_clk();