Jump to content
Sign in to follow this  

Self-powered USB device with Stellaris Launchpad

Recommended Posts



I am trying to implement a self-powered USB device (CDC) with the Stellaris Launchpad. Unfortunately, it turned out that the LM4F120 MCU has limited "device only" USB controller which does not feature the dedicated VBUS sensing pin USB0VBUS (PB1) that is required to make StellarisWare USBlib work properly and catch the USB_EVENT_DISCONNECTED event on a self-powered device. Fortunately, the board has another GPIO pin (PD7) which is connected for VBUS sensing but nowhere is documented how this pin can be used with USBlib.


Now my question is how to implement the self-powered device properly on this board, starting with the original usb_dev_serial code from StellarisWare. I am new to StellarisWare and find some docs incomplete and confusing. Also I am not completely sure that StellarisWare's USBlib has been adapted to this board properly...


First, do I have to call USBDCDInit() with the USB_MODE_DEVICE or with the USB_MODE_FORCE_DEVICE parameter on this MCU or doesn't it matter at all?


Then as far as I understand I need to configure my own interrupt handler for the VBUS sensing on PD7. Maybe when VBUS is present I should call the USBDCDInit() function and when VBUS is lost (caused by a USB cable disconnect) I should call USBDCDCTerm(). Is this the correct way to do it in order to also comply with the USB requirements. The docs for other Stellaris MCUs featuring USB Device/OTG/Host state that if the host removes VBUS, a self-powered Device has to disable the D+/D- pull-up resistors. Unfortunately, I did not find any demo code for that. How can this be achieved on this board with StellarisWare calls?


BTW, I have already asked a very similar question on the TI forums but did not get much information:


Therefore, I hope that the experts here can give me some hints.


Thank you in advance!



Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...