This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Hibernation and USB Controller

Hi there,

I am trying to make the LM4f232 hibernate to save power, but I also have to write data into an USB stick.  I have no problem writing data into a file in an USB stick, and my device can go into the hibernation mode without a problem.  However, when I combine these two peices of code together, the USB controller can't detect USB stick.  I am using interrupt when the device wakes up due to the RTC, and I have the USB enabled in the hibernate interrupt handler.  Am I doing it right? 

The following is how I re-initialized USB in the hibernation interrupt handler when the device wakes up.  By the way, I also initialize the USB in the main() function before I initialize the hibernate module. 

void
HibernateHandler(void)
{
 unsigned long ulStatus;
 unsigned long ulDriveTimeout;
 int i;

 //
 // Get the interrupt status, and clear any pending interrupts.
 //
 ulStatus = HibernateIntStatus(1);
 HibernateIntClear(ulStatus);

 ROM_SysCtlPeripheralReset(SYSCTL_PERIPH_USB0);

 g_eState = STATE_NO_DEVICE;

 USBStackModeSet(0, USB_MODE_HOST, 0);

 USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ulNumHostClassDrivers);

 g_ulMSCInstance = USBHMSCDriveOpen(0, MSCCallback);                    --> MSCCallback never gets called, so the status is always STATE_NO_DEVICE

 ulDriveTimeout = USBMSC_DRIVE_RETRY;

 USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);

 USBHCDInit(0, g_pHCDPool, HCD_MEMORY_SIZE);

 FileInit();

 USBHCDMain();

}

 

Thank you

Kevin

 

  • Hi Kevin,

    The USB init looks very much like the code we provide in the examples and thus I expect that is fine. I assume you are calling UBHCDMain() regularly outside the Hibernate handler, correct?

    You might try disabling the USB PLL prior to hibernate and re-enabling after you come back up (via SysCtlUSBPLLDisable() and SysCtlUSBPLLEnable() respectively). If that does not resolve the issue, I will probably need to see more of the source.