Content originally posted in LPCWare by andy_man on Sun Apr 03 08:04:18 MST 2016
Hi all,
I am trying to use the PLL0 clock to drive the USB clock at 48 MHz, which I accomplished. Now I am trying to configure the USB peripheral. In my program so far I setup the PLL0 clock. Then I successfully enabled PCUSB. But when I try and turn on the DEV_CLK_ON bit and the AHB_CLK_ON bit the LPC_USB->USBClkSt register does not show that the bits have been enabled in simulation. My goal is to initialize and configure the USB peripheral on my own so I get a good understanding of how it functions.
//my code to setup the USB
void usb_setup(void){
LPC_SC -> PCONP |= 0x80000000; //enable PCUSB
LPC_USB->USBClkCtrl = 0x1A; //turn on DEV_CLK_ON and AHB_CLK_ON
while((LPC_USB->USBClkSt & 0x1A) != 0x1A); //wait until the USBClkSt register recognizes the changes in USBClkCtrl
return;
}