void Chip_USB0_Init(void) { /* Set up USB PLL */ Chip_USB_PllSetup(); /* Setup USB0 base clock as clock out from USB PLL */ Chip_Clock_SetBaseClock( CLK_BASE_USB0, CLKIN_USBPLL, true, true); /* enable USB main clock */ Chip_Clock_EnableBaseClock(CLK_BASE_USB0); Chip_Clock_EnableOpts(CLK_MX_USB0, true, true, 1); /* enable USB0 phy */ Chip_CREG_EnableUSB0Phy(); }
void Chip_USB1_Init(void) { /* Setup and enable the PLL */ Chip_USB_PllSetup(); /* USB1 needs a 60MHz clock. To get it, a divider of 4 and then 2 are chained to make a divide by 8 function. Connect the output of divider D to the USB1 base clock. */ Chip_Clock_SetDivider(CLK_IDIV_A, CLKIN_USBPLL, 4); Chip_Clock_SetDivider(CLK_IDIV_D, CLKIN_IDIVA, 2); Chip_Clock_SetBaseClock(CLK_BASE_USB1, CLKIN_IDIVD, true, true); /* enable USB main clock */ Chip_Clock_EnableBaseClock(CLK_BASE_USB1); Chip_Clock_EnableOpts(CLK_MX_USB1, true, true, 1); /* enable USB1_DP and USB1_DN on chip FS phy.*/ LPC_SCU->SFSUSB = 0x12; }