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.

CCS/TM4C123GH6PM: Tiva C launchpad, working as USB host, cannot enumerate.

Part Number: TM4C123GH6PM
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

  • HI,

    I'm not familiar with AFE4490 SPO2 EVM and neither an USB expert . The AFE4490 SPO2EVM board comes with the GUI tool and USB drivers for the PC to evaluate the AFE4490 device. Why are you using the TM4C LaunchPad to interface with the AFE4490 SPO2 EVM? Are you going to create your own device driver to configure the AFE4490 and the rest of the components on the AFE4490 SPO2 EVM board. It seems like a daunting task. If you want USB host examples then there are a few of them in TivaWare Library. Please look under <TivaWare_Installation>\examples\boards\dk-tm4c123g.

    You will need to populate the R25 and R29 with the 0ohm resistors on the LaunchPad if you want to provide power to the your device.
  • Dear Charles,

    Thank you very much. I am trying to use tiva c to get data from evm. the tiva c here will also handle other tasks. evm is just a slave to tiva c.

    I have two detailed concerns now.

    1. I have populated R25 and R29, and provice power to usb device. But when I power the tivc c pad using the debug usb interface, sometime the arm MCU become very hot. So I have to unplug and plug the debug cable again. Then it is ok. It happened several times. Do you have some ideas of this?

    2. THE AFE EVM is a CDC (common device class) device. But I did not find a cdc host example in the Tivaware lib. Can you please let me know where to find a cdc host example for tivaC launchpad?

    Thank you!

    Jackie
  • Hi Jackie,

     You are trying to power the AFE4490 board using the TM4C123 Launchpad. You need to find out how much current the AFE board needs. It may be too much loading on the TM4C. As noted below I will suggest provide power to the board via the boosterpack.

    The TM4C123GH6PM target device is also capable of USB embedded host and on-the-go (OTG)

    functions. OTG functionality can be enabled by populating R25 and R29 with 0-Ω resistors. These

    resistors connect the USB ID and USB VBUS signals to PB0 and PB1. When these resistors are populated,

    PB0 and PB1 must remain in the respective USB pin mode configurations to prevent device damage. PB0

    and PB1 are also present on the J1 BoosterPack header. Therefore, if R25 or R29 are populated, care

    must be taken not to conflict these signals with BoosterPack signals.

    USB embedded host operation can be enabled in the same way for USB devices that are self-powered.

    Providing power when acting as a USB host requires a BoosterPack with power switching and appropriate

    connectors. All USB host signals are available on the BoosterPack interface except D+ and D–, which are

    only available on the USB micro-A/-B connector and the two adjacent test points.

    When connected as a USB device, the evaluation board can be powered from either the ICDI or the USB

    Device connectors. The user can select the power source by moving the POWER SELECT switch (SW3)

    to the Device position. See the Power Management schematic (appended to this document).

    We don't have cdc class examples for usb host. We only have for usb device. 

  • Hi Charles,

    Thank you for the reply!

    Now not hot problem happening. Not sure why it happened before.

    I have found cdc code for tiva c usb host. Just one question about the enumeration.

    Do different mode (say, cdc, or msc) share the same enumeration process? Where to see the c code of this process?

    Currently, the tiva c could not enumerate the evm board, so the evm board enters into 'State_NOENUM_SUSPENDED'.

    Thanks!

    Jackie

  • Hello Jackie,

    The enumeration processes would be similar but not the same. Complex devices like CDC devices need more enumeration steps than simple devices like a HID device. CDC for example needs to look for Sub Class information.

    The usbhostenum.c file in usblib/host is probably what you are looking for.