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.

USB Host example for EK-TM4C123GXL both SW and HW

Other Parts Discussed in Thread: EK-TM4C123GXL, TPS2052

Can somebody provide a working project usb host example for ek-tm4c123gxl evalutaion launchpad board with appropriate hardware connection. I couldn't figure it out over days and hours. 

//
    // Enable all the GPIO peripherals.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    
    HWREG(GPIO_PORTC_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTC_BASE + GPIO_O_CR) = 0xff;
    ROM_GPIOPinConfigure(GPIO_PC6_USB0EPEN);
    ROM_GPIOPinTypeUSBDigital(GPIO_PORTC_BASE, GPIO_PIN_6);
    
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTB_BASE, GPIO_PIN_0 | GPIO_PIN_1);    
    ROM_GPIOPinTypeUSBAnalog(GPIO_PORTD_BASE, GPIO_PIN_4 | GPIO_PIN_5);

    //
    // Enable Clocking to the USB controller.
    //
    ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_USB0);

I could not turn the port PB1/USB0VBUS to give 5V I am measuring it with multimeter.

Thanks.

  • Hi Arden,

         The Tivaware package for other Tiva kits has USB host examples. These below are what I found at Tivaware for my Tiva Connected Launchpad and EK-LM4F232. 

    1. usb_host_keyboard
    2. usb_host_mouse
    3. usb_host_msc

    -kel

  • Hi Markel,

    Tkans for your reply. I already looked to theTivaWare of TM4C129xxx launchpad examples and coppied the codes but did not work. I am watching serial port to inform what happened. 

    Also as a hardware consideration I need some schematic or picture to know how to connect my pins to usb female connector. I couldn't set the PB1 to give USB0VBUS to gibe 5 V.

  • Hi,

    Arden Kuyumcu said:
    Tkans for your reply. I already looked to theTivaWare of TM4C129xxx launchpad examples and coppied the codes but did not work.

    See, if Tivaware for DK-TM4C123G has USB host examples.

    http://www.ti.com/tool/dk-tm4c123g

    If there are USB host examples at Tivaware for DK-TM4C123G, you will need to make some changes to make it work for your Tiva Launchpad. 

    - kel  

  • I am changing the pin names already. CAn you explain which pins of usb female connector is need to be connected to which pin son board. I Connected PB1 to VCC +5V to female connector assuming usb mouse will be powerd via PB1/USB0VBUS. PD4/USBDM and PD5/USBDP to D- and D+ on female connector respectively. Finlyy the GND to GND. I even couldn't power the mouse up.

    Thank you. 

  • Hi Arden,

        I think it will help if you review the schematic of DK-TM4C123G, with regards to these pins. The schematic can be found at the DK-TM4C123G User's Guide. 

    - kel

  • I am realy new in electronics and embedded software. I am looking schematics to DK- board. Do I need a load switch and a connection like in the board. It uses tihs TPS2052BDRB component. Do I realy need this?. I red the usb bus epen like things but have confusions. IF I dont use that laod switch where I need to connect the EPEN pin in case of PC6 pin, or do I realy need to connect It. 

    It is not clear that. From where the mouse will take its power. I am thnking over PB1/USB0VBUS bt with software it dont gives 5V output. THe other way is direcly connect to VBUS. Which is correct? :/

  • Hi,

    To get pin PB1 to have 5V, you need two things (I am talking about EK_TM4C123GXL - Launchpad):

    a) move your USB cable to connector J9 (left side) - see also schematic diagram in spmu296.pdf;

    b) move the switch SW3 in position "Device" (leftmost) - the other is for ICDI, and plug-in the cable to PC. 

    Basically when testing the examples provided, first place the cable and SW3 for ICDI to download the software and then move to J3/Device to connect to USB. (For development you will need a second cable and the switch to ICDI position…)

    Take care to install USB drivers on PC first. Read the Tiva/docs/EK-TM4C123GXL Firmware Development Package.pdf.

    Do not mix things with TM4C129 since there are differences between the two micros. Also, when trying examples, do not "copy-paste" - will "not work" (until you will get all tricks) - better to import the project, from menu Project | Import CCS Project

    Petrei

  • Hi Petrei,

    Thank you. I am looking the project file also and I dont see any compling error and I am checking the pin names and supported other things. I am coping by mostly understanding what I am doing. 

    I will try your suggestion about J9 Usb connection. Bur what if I connect external 5V power supply to VBUS directiy to use as a mobile device rather than connect to pc as I just want to control the motors or leds or servos etc with gamepad or mouse it needs to be mobile. I dont hanve any connection as suggesteded in place of R25 and R29 0 ohm resistors. Is this an restriction?

    I want to use the device in host mode. Do I need any windwos firmware for it?

    It is not all about to have PB1 5V. It is about what is USB0VBUS actualy. IF I set this why it does not give 5V. Let say if I use the board as OTG and connect a flash memory or mouse Like my purpose with OTG cable. How thay take theri power over the usb connector while it is connected to pc and to connect J9 VCC to PB1 R29 needs to be short circuit. I am still having my confusions. :(

  • Hi Arden,

    Your device, in your case a flash memory, need to be self-powered in order to function as a host, this is because PB1 are not able to supply enougth current to power up your flash memory, please read 2.1.2 USB Connectivity in spmu296, furthermore PB1 are in analog state function (input) acting as line voltage monitor.

    Note that in TM4C1294 connectivity kit a TPS2052 act as power switch controlled by PD6 (USBEPEN) suppling +5V to USB Device as needed.

    Tales Amorim