• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Microcontrollers » Stellaris® ARM® Microcontrollers » Stellaris® ARM® LM3S Microcontrollers Forum » LM3S3748 USB HOST supporting Hub
Share
Stellaris® ARM® Microcontrollers
  • Forum
Options
  • Subscribe via RSS
Helpful Stellaris® LM4F Series Links
  • LM4F Series
  • Stellaris PinMux Utility
  • Stellaris® LM4F120 LaunchPad
  • LM4F MCU Applications
  • LM4F MCU Video
  • ARM Cortex-M4F Whitepaper
  • Stellaris MCU Brochure
  • LM4F232 Eval Kit
  • Forums

    LM3S3748 USB HOST supporting Hub

    This question is answered
    sakaken
    Posted by sakaken
    on Mar 13 2012 01:57 AM
    Prodigy160 points

    I am working connect USB Keyboard and USB Mouse to LM3S3748 USB Host at the same time using USB HUB.

    I can find USB Keyboard and  Mouse sample code, there are no hub sample code.

    Could you provide hub sample code?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Jonathan Guy
      Posted by Jonathan Guy
      on Mar 13 2012 08:53 AM
      Expert5630 points

      We can help with using the USB hub functions.  The first thing to be aware of is that the LM3S3748 device has an erratum for USB hub operation with low-speed USB devices (Errata 12.5).  Hub will only work on devices with date code 0x1A or later.   Does your target device have a 0x1A or later date code?

      Jonathan Guy

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Stellaris Paul
      Posted by Stellaris Paul
      on Mar 13 2012 16:05 PM
      Expert8170 points

      If you want to try enable the hub code you will need to add a small bit of code to your application:

      //*****************************************************************************
      //
      // The size of the host controller's memory pool in bytes.
      //
      //*****************************************************************************
      #define HUB_POOL_SIZE (HCD_MEMORY_SIZE * MAX_USB_DEVICES)

      //*****************************************************************************
      //
      // The memory pool to provide to the hub driver. This pool is used to hold the
      // configuration descriptors of the devices attached to the hub. It must be
      // sized to be at least
      // (MAX_USB_DEVICES * (largest expected configuration descriptor)) bytes.
      //
      //*****************************************************************************
      unsigned char g_pucHubPool[HUB_POOL_SIZE];
      //*****************************************************************************
      //
      // The instance data for the hub, this is internal data and should not be
      // accessed by the application.
      //
      //*****************************************************************************
      tHubInstance g_HubInstance;

      //
      // This is a null function will get events from the hub.
      //
      unsigned long
      HubCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam,
      void *pvMsgData)
      {
      return(0);
      }
      In main() before HCDInit() call
      //
      // Open a hub instance and provide it with the memory required to hold
      // configuration descriptors for each attached device.
      //
      USBHHubOpen(HubCallback, g_pucHubPool, HUB_POOL_SIZE, &g_HubInstance, 1);
      
      
      The remaining calls to initialize the mouse and keyboard should remain just as in the normal examples.  The errata still applies and if you have an older part you will see intermittent behavior when using the low speed devices.  
      Please note that nearly all evaluation boards will have the older devices and will be subject to the errata.
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Tsuneo Chinzei
      Posted by Tsuneo Chinzei
      on Mar 13 2012 20:48 PM
      Expert2650 points

      Congratulation to hub support !!
      It should produce huge advantage to Stellaris among Cortex-M3/M4 MCUs.

      I noticed a couple of minor timing problem in usbhhub.c in the latest StellarisWare 8555.

      The USB2.0 spec defines these timing around device connection - bus reset in "USB 2.0 Connect Timing ECN.pdf", distributed with USB2.0 spec zip file,
      http://www.usb.org/developers/docs/usb_20_101111.zip

      Here are excerpts from "USB 2.0 Connect Timing ECN.pdf"

      delta-T4 (Tcon_rst)
      This is a debounce interval with a minimum duration of 100 ms that is provided by USB System Software. It ensures that the electrical and mechanical connection is stable before software attempts to reset the attached device...

      delta-T6 (Trstrcy)
      The USB System software guarantees a minimum of 10 ms for reset recovery. Peripheral response to any bus transactions addressed to the default device address during the reset recovery time is undefined.

      Any hub doesn't provide these timing. Host stack is responsible to ensure these timing.

      In the current usbhhub.c, USBHHubMain() orders bus reset to hub immediately after the detection of device connection (HUB_PORT_STATUS_DEVICE_PRESENT), in this calling sequence.
      HubDriverDeviceConnect() -> HubDriverDeviceReset() -> HubSetPortFeature( HUB_FEATURE_PORT_RESET )

      Above delta-T4 delay comes here, between the detection of connection and bus reset order.

      Also after seeing HUB_PORT_CHANGE_RESET, USBHHubMain() starts enumeration immediately in this calling sequence.
      HubDriverReset() -> USBHCDHubDeviceConnected()

      Above delta-T6 delay is inserted here.


      Some devices with MCU are still running their startup initialization when they assert D+ (D-) pull-up. Especially, with fixed D+ (D-) pull-up.  Such devices misses bus reset if host would issue bus reset too early. Delta-T4 saves such devices.

      Hope this help.

      Tsuneo

      USB
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • sakaken
      Posted by sakaken
      on Mar 14 2012 05:13 AM
      Prodigy160 points

      I added above code adviced from Paul-san and testing.

      Also I added delta-T4 and T6 delay adviced from Chinzei-san at USBHHubMain() in usbhhub.c,

      When I connect only HS HUB, "UARTprintf("Unsupported Device Connected\n")" is come on terminal soft.

      Date code on the LM3S3743 is IQC50A0D0, so I understand LS HID device under HUB will fail

      to connect.

      I will continue investigation.

      If you miss something, please let me know.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Stellaris Paul
      Posted by Stellaris Paul
      on Mar 14 2012 08:29 AM
      Expert8170 points

      Glad to hear that it is working for you.  

      I will open an issue for the connect timing with the hub so that we can look into it.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • sakaken
      Posted by sakaken
      on Mar 15 2012 03:52 AM
      Verified Answer
      Verified by sakaken
      Prodigy160 points

      I found the reason hub driver is not roaded.

      Fllowing code is need to add,

      static tUSBHostClassDriver const * const g_ppHostClassDrivers[] =
      {
       &g_USBHIDClassDriver, &g_USBHubClassDriver,&g_sUSBEventDriver
      };

      I supposed FS Keyboard under the hub is not work, But is working now.

      Key code come on lcd display and windows serial terminal soft..

       

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Stellaris Paul
      Posted by Stellaris Paul
      on Mar 15 2012 08:13 AM
      Expert8170 points

      Sorry, I forgot about that.  That is what loads the Hub driver so that the USB library can work with hubs.

      "USB Hub" USB
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • sakaken
      Posted by sakaken
      on Mar 22 2012 00:58 AM
      Prodigy160 points

      Now I could support USB Host-Hub-Keyboard and Mouse.

      I need to support multi connection hub, Host-Hub-Hub-Keyboard and Mouse.

      Could you advice how to modify usbhhub.c?

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Betul TURK
      Posted by Betul TURK
      on Apr 30 2012 08:19 AM
      Prodigy185 points

      Any of you can explain how Ican add delta T4 and delta T7 delays?? my hub does not work lways. I think the reason of this problem is timing, is it right??

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Stellaris Paul
      Posted by Stellaris Paul
      on May 02 2012 16:47 PM
      Expert8170 points

      Betul, your problem is more than likely due to the errata on hubs with low speed devices.  You will need to check the date code listed in the errata for your part to determine if you can run with a hub and low speed devices.

      http://www.ti.com/lit/er/spmz038m/spmz038m.pdf

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Betul TURK
      Posted by Betul TURK
      on May 03 2012 07:30 AM
      Prodigy185 points

      I have solved that problem Paul, thanks. Another problem is about using two USB device on hub. I want to connect two USB memorys at the same time and I want to use them respectively with no error. I know that, I should reach their own adresses but I don't know how I can find their memory address. I hope I could explain my problem=)

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Betul TURK
      Posted by Betul TURK
      on May 06 2012 08:16 AM
      Prodigy185 points

      Did you solve your problem about multi connection? If you solved, could you help me??

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Venkatadri Shantaram84961
      Posted by Venkatadri Shantaram84961
      on Mar 22 2013 07:06 AM
      Verified Answer
      Verified by sakaken
      Prodigy555 points

      Hi

      I know it is veyr long time gap, have you solved this or still open?

      Thanks and Warm Regards

      Venkat

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use