|
Hello Anand
Thank you very much for your hints!
@1: I know the specification of the crystal but I will replace it on my board.
@2: If the USB cable is not connected to my board then the oscillator is still oscillating. PA3 is used for USB wakeup.
Then if I put my finger to the D+ line the crystal stops to oscillate. Moste of the time a reset is enough to restart the USB-controller, sometimes not. For my understanding, if the crystal normally do not stop, the USB-controller do not switch to suspend mode.
Attached the code of the main code:
void main(void)
{
...
EZUSB_IRQ_ENABLE(); // Enable USB interrupt (INT2)
EZUSB_ENABLE_RSMIRQ(); // Wake-up interrupt
INTSETUP |= (bmAV2EN | bmAV4EN); // Enable INT 2 & 4 autovectoring
USBIE |= bmSUDAV | bmSUTOK | bmSUSP | bmURES | bmHSGRANT; // Enable selected interrupts
EA = 1; // Enable 8051 interrupts
.....
// Task Dispatcher
while(TRUE) // Main Loop
{
// Poll User Device
TD_Poll();
// Check for pending SETUP
if(GotSUD)
{
SetupCommand(); // Implement setup command
GotSUD = FALSE; // Clear SETUP flag
}
// check for and handle suspend.
// NOTE: Idle mode stops the processor clock. There are only two
// ways out of idle mode, the WAKEUP pin, and detection of the USB
// resume state on the USB bus. The timers will stop and the
// processor will not wake up on any other interrupts.
if (Sleep)
{
if(TD_Suspend())
{
Sleep = FALSE; // Clear the "go to sleep" flag. Do it here to prevent any race condition between wakeup and the next sleep.
do
{
EZUSB_Susp(); // Place processor in idle mode.
}
while (!Rwuen && EZUSB_EXTWAKEUP());
// above. Must continue to go back into suspend if the host has disabled remote wakeup
// *and* the wakeup was caused by the external wakeup pin.
// 8051 activity will resume here due to USB bus or Wakeup# pin activity.
EZUSB_Resume(); // If source is the Wakeup# pin, signal the host to Resume.
TD_Resume();
}
}
}
}
Friendly regards
Geri
|