• 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 » USB Discon Interrupt
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
  • USB Discon Interrupt

    USB Discon Interrupt

    This question is not answered
    Sam Wong
    Posted by Sam Wong
    on Jun 03 2012 15:56 PM
    Prodigy100 points

    I don't seem to get any USB Disconnection interrupt. I tried the usb-dev-serial and the usb-dev-msc projects on a DK-LM3S9B96 eval board and also on my own board with a LM3S9U96. The LCD never showed "Host Disconnected" nor breakpoint for USB_EVENT_DISCONNECT ever triggered inside the interrupt handling routines. I searched the web for two days and found only one mentioning in Marc 2011 and that wasn't a real solution either: monitoring USBxVBUS.

    What prompted this search was that when running usb-dev-msc on a DK-LM3S9B96, ejecting the drive on Windows 7 64-bit Professional always failed. Closing the USB device from the bottom right corner of the windows task bar worked, but the .close function was never called on the usb-dev-msc side. 

    Any help would be appreciated.

    Sam

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    All Replies
    • Sean de la Haye
      Posted by Sean de la Haye
      on Jun 04 2012 13:09 PM
      Intellectual2015 points

      Sam,

      I have been able to replicate this problem.  I will take a look at the code in usblib, talk to my coworkers and let you know what can find out.

      Thanks,

      Sean

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sam Wong
      Posted by Sam Wong
      on Jun 04 2012 15:42 PM
      Prodigy100 points

      Sean,

      Thanks for looking into this. I did find one line which is probably wrong. I think it is in usbdmsc.c. The routine HandleDisconnect has

          If (psDevice->psPrivateData->pvMedia == 0)

      I think "==" should be “!=”. But that didn’t solve the problem since the interrupt was never generated to begin with. I did check the USBIS and USBIE registers, they were set correctly with DISCON bit set in USBIE.

      Sam.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sean de la Haye
      Posted by Sean de la Haye
      on Jun 08 2012 10:47 AM
      Intellectual2015 points

      Sam,

      I found that the change you suggested has already been integrated into the latest version of usbdmsc.c.  You should see it in the next release. 

      I'm still trying to determine why the interrupt is not triggering.  I'm not seeing the bit get set in the USBIS -- I'm seeing the CONN bit set, not DISCON.  The USB expert has been out this week, so I'll hopefully have an answer on Monday.

      Thanks,

      Sean

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sean de la Haye
      Posted by Sean de la Haye
      on Jun 11 2012 11:43 AM
      Intellectual2015 points

      Sam,

      I tried the usb_dev_msc example on my dk-lm3s9b96 board with RevC silicon and I'm getting a disconnect interrupt.  It appears that I wasn't getting a disconnect interrupt on my ek-lm4f232 due to errata 10.1.  Do you know what revision of silicon you are using on your boards? What voltage is your VBUS pin going to after you disconnect?

      As for disconnecting within Windows, I was told that there currently is not a way for the device to detect the change.

      Thanks,

      Sean

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sam Wong
      Posted by Sam Wong
      on Jun 14 2012 16:06 PM
      Prodigy100 points

      Sean,

      I have a dk-lm3s9b96 board with RevC silicon too (IQC80C3XD). Where did you look for the disconnect interrupt? USBDMSCStorageClose was never called. I added USB_EVENT_DISCONNECTED case to USBDMSCEventCallback in usb_dev_msc.c and the USB_EVENT_DISCONNECTED was never received. I went all the way back to the usblib code and didn't see any DISCONNECTED event.

      The VBUS pin reads 5V when connected, as expected. When the USB cable is removed, it drifted back to 3.3V which was the internal pullup of the VBUS microntroller pin, I believe. Same voltages measured on the dk-lm3s9b96 board and on my own board.

      Regarding your last statement, are you saying that when I eject the device on the Windows side, the disconnect event from the Windows side would never be detected by the microcontroller? Does the USB module inside the ucc rely on the disappearance of the VBUS voltage to generate a DISCONNECT? If so, then an external pulldown resistor would be required on the VBUS pin, right? I guess one solution, as pointed out by a post last year, is to add the pulldown resistor and use the VBUS pin to generate a generic GPIO interrupt. 

      The only reason I'm fixated on the DISCONNECT event is that I'm implementing the storage with a SPI serial flash IC. The DISCONNECT event would allow me to flush pending writes to the IC. 

      Thanks.

      Sam.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sean de la Haye
      Posted by Sean de la Haye
      on Jun 14 2012 17:17 PM
      Intellectual2015 points

      Sam,

      I'm looking in the USBIS register for the interrupt.  I'm also seeing HandleDisconnect and USBDMSCStorageClose called.  When I disconnect the cable, I see vbus on my dk-lm3s9b96 board go from around 5V to 0V.  There shouldn't be a pull up on VBUS -- if it is at 3.3V, then there is problem.  The interrupt is only generated when the voltage goes below a threshold in OTG mode.  If you force Device mode, then you will not get the interrupt due to errata 13.4. Have you modified the usb_dev_msc example?  Try a clean copy from the 8555 release and see if you still get the problem. 

      The disconnect operation in Windows is just used to flush pending buffered writes to the device before unplugging it.   The disconnect interrupt is purely based on the VBUS level. 

      Sean

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sam Wong
      Posted by Sam Wong
      on Jun 14 2012 18:56 PM
      Prodigy100 points

      I didn't realize that there is a newer 8555 release. I was running the one that came with the dk-lm3s9b96 kit. 

      I downloaded the 8555 release and tried to recreate the usb_dev_msc project. Somehow this release did not create all the necessary folder links to the driver folders. So the project didn't build correctly, complaining about a bunch of unresolved objects. I was following the Quickstart-Eval-kit-CCS.pdf file from the CCS dvd that came with the dk-lm3s9b96 kit. Is there a newer file?

      Thanks.
      Sam. 

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sam Wong
      Posted by Sam Wong
      on Jun 14 2012 22:10 PM
      Prodigy100 points

      Sean,

      I added the missing file links to the usb_dev_msc and got it working. You were right, DISCONNECTED events were indeed generated with the 8555 release. Sorry to have troubled you.

      Are there example projects that put usb_dev_msc and usb_dev_serial into a composite device?

      Thanks.

      Sam.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Sean de la Haye
      Posted by Sean de la Haye
      on Jun 15 2012 15:50 PM
      Intellectual2015 points

      Sam,

      You can download the latest quickstart here: http://www.ti.com/litv/pdf/spmu057e

      Sorry, we don't have an example of a composite device with those two.  

      Sean

      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