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