Hi,
I am trying to suspend the USB 1 port. The LPC1857 is the Host and I have a fingerprint module connected to USB1.
Here is my code and the chip hangs up (when I run in debug mode with LPC link, it shows that CPU is stalled when i run this code).
void USB1_ForcePortSuspend()
{
// only set suspend bit if the port is currently enabled (PE bit set to 1)
if (LPC_USB1->PORTSC1_H & (1 << 2))
{
LPC_USB1->PORTSC1_H |= 1 << 7; // Enable suspend bit
// wait for port to suspend
while (!(LPC_USB1->PORTSC1_H & (1 << 7)));
vTaskDelay(1000);
// now suspend the PHY Clock
LPC_USB1->PORTSC1_H |= (1 << 23);
// wait for the clock to suspend
while (!(LPC_USB1->PORTSC1_H & (1 << 23)));
vTaskDelay(10);
}
}
Is there a recommended step to suspend the USB 1 port?
Just to add on that it is when i suspend the PHY clock that the CPU gets stalled.
Thanks!