Other Parts Discussed in Thread: AFE4490,
Tool/software: Code Composer Studio
Hi TI experts,
I have read basically all posts in this forum, which gave me a lot of help to configure the launchpad as a USB host.
But I am stuck by one issue, and could not find answers to it. THank you.
In my case, launchpad works as usb host, and AFE4490 SPO2 EVM board as usb slave. But the enumeration cannot be established.
My code on launchpad:
// enable usb peripheral
SysCtlPeripheralEnable (SYSCTL_PERIPH_USB0);
//Initialize the USB stack for host mode
USBStackModeSet(0,eUSBModeHost,0);
//Enable the GPIO peripherals used by the USB pins
SysCtlPeripheralEnable (SYSCTL_PERIPH_GPIOB);
//enable GPIO pins for USB: PB0 and PB1 as VBUS and ID pins
GPIOPinTypeUSBAnalog (GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);
// Enable the D+/ D- as USB pins
ROM_GPIOPinTypeUSBDigital(GPIO_PORTC_BASE, GPIO_PIN_6 | GPIO_PIN_7);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);
//Register the host class drivers
USBHCDRegisterDrivers (0, g_ppsUSBHostClassDrivers, g_ui32NumHostClassDrivers); //will turn off LED port F Pin 2
// Initialize the power configuration. Set the power enable signal to be active high and does not enable the power fault.
USBHCDPowerConfigInit (0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);
// call any open routines here for the application to be ready for a new mass storage device
tUSBHMSCInstance *g_psMSCInstance= USBHMSCDriveOpen (0, MSCCallBack); // open an instance of the mass storage class driver
USBHCDInit (0, g_pui8HCDPool, HCD_MEMORY_SIZE); // initialize the host controller
// main loop of the application
while (1)
{
switch (iMSDState)
{
//This state is entered when the pen drive is first detected.
case MSD_INIT:
{
//turn off LED
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0);
//initialize the newly connected pen drive
// wait for the drive to become ready- wait for the value to go to 0 before the host controller attempts to read or write from the device.
while ( USBHMSCDriveReady (g_psMSCInstance))
{
SysCtlDelay(100000 / 100); //delay given for the device to be ready
}
//move it to connected state
iMSDState= MSD_CONNECTED;
break;
}
case MSD_CONNECTED:
{
// glow an LED if the pen drive is detected.
GPIO_PORTF_DATA_R |= 0x08;
for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++);
GPIO_PORTF_DATA_R &= ~(0x08);
for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++);
break;
}
case MSD_NOT_CONNECTED:
{
}
default:
{
break;
}
} //end of switch
USBHCDMain( ); // Periodic call for the Host Controller Drivers
}//end of while
Thank you very much!
Best
Jackie