Hi,
I am using the MCUXpresso IDE to program a LPC4088 controller. In part of my code I want to initialize the USB host and trying to enable the USB host, OTG clock and AHB master clock. So, I use this instruction
LPC_USB->OTGClkCtrl = 0x00000019.
After that, when I check LPC_USB->OTGClkSt, its binary value is 10000, which shows the device host clock and OTG clock are not available! Can you please help me to find what is wrong?
Hi,
I think that you have to enable the USB gated clock before you write the LPC_USB->OTGClkCtrl = 0x00000019.
You can enable the USB gated clock with the line:
SYSCON->PCONP|=1<<31;
Pls refer to section 3.3.2.2 Power Control for Peripherals registers in UM10562.pdf
If you still can not, i suppose you have to enable the 48MHz USB clock
Hope it can help you
BR
XiangJun Rong
Hi,
Thank you for your response. I actually had "LPC_SC->PCONP |= 0x80000000;" before using "LPC_USB->OTGClkCtrl = 0x00000019;" in my code (PCONP[31] is 0x1 which confirms the USB gate is turned on).
The problem is that when I do "LPC_USB->OTGClkCtrl = 0x00000019", LPC_USB->OTGClkSt is not equal to 0x00000019, which I cannot understand why!
Hi,
Pls try to set the USBDIV with a non-zero value, you'd better get 48MHz USB clock by configuring the register including the USBDIV bits and USBSEL bits.
This is the procedure:
1)LPC_SC->PCONP |= 0x80000000
2)LPC_SC->USBCLKSEL=0x01|xx;
3)LPC_USB->OTGClkCtrl = 0x00000019;
4)checking the LPC_USB->OTGClkSt register
Hope it can help you
BR
XiangJun Rong