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.

Stellaris Launchpad USB code doesn't work on Tiva Launchpad

Other Parts Discussed in Thread: TM4C123GH6PM, EK-TM4C123GXL

I'm struggling to get my USB device code (developed on the Stellaris Launchpad) to work on the Tiva Launchpad. Most of the postings indicate code should work "as is" but when I program working code to my Tiva board the USB device never connects (and Windows doesn't indicate it sees a device). I swap it with a Stellaris Launchpad (with no other changes) and the project works correctly.

Is there a hardware difference that would affect things? As I understand it the Tiva USB mode defaults to device so I wouldn't expect anything there. I can provide example code but you can see the same behavior if you program the Tiva with the TI provided usb_dev_serial example that came with StellarisWare in the boards\ek-lm4f120xl folder.

Any help would be appreciated, I have tried comparing the code to the new Tivaware examples but can't find the smoking gun among the many changes.

 

  • Hi Jeff,

    The preprocessor defines are different from the project options of LM4F120 Launchpad compared to Tiva Launchpad. See below.

    LM4F120 Launchpad Preprocessor defines

    PART_LM4F120H5QR TARGET_IS_BLIZZARD_RA1

    Tiva Launchpad Preprocessor defines

    PART_TM4C123GH6PM TARGET_IS_BLIZZARD_RB1

    You can also do a register address compare. I would also advice, to use the usb example program at SW-EK-TM4C123GXL as base for your application.

    - kel

  • Thanks Kel for the response, I'm still a bit confused as to why the pre-processor defines would prevent existing code from working on the TIVA, I didn't reconfigure the project so as far as the code should be concerned its being applied to a LM4F120H5QR (It shouldn't actually be able to tell that its a TM4C123GH6PM). If that is true then as long as the hardware functions the same it should work, right?

    I agree if starting from scratch I should use a newer example program but at this point I would prefer to get the existing code to work correctly, which according to a few TI postings discussing the differences between the launchpads the code should work without changes.

     

     

  • Hi Jeff,

    The Tiva launchpad as an OTG MCU, while the Stellaris launchpad has a device only MCU. If you are going to use the USB as device only, you need to specify that in your software using the USBDevMode() API.  Otherwise, the USB controller expects that Host/Device information is provided on the USB0ID signal.

    Regards,

    Sue

  • Sue - Thanks for the reply! To simplify the discussion the usb_dev_serial project that comes with Stellarisware (default Win install located here C:\StellarisWare\boards\ek-lm4f120xl\usb_dev_serial) has the same issue as my code so I will reference that to ease repro:

    The usb_dev_serial code contains the following in main, does this not specify that? If so any pointers to the specific call needed to make this project work on the Tiva?

        // Set the USB stack mode to Device mode with VBUS monitoring.
        //
        USBStackModeSet(0, USB_MODE_DEVICE, 0);

    Thanks for your patience and help!

     

  • Hi Jeff,

    The function you list above will work if the PB0 and PB1 pins are properly configured to be ID and VBUS.  If they are not configured, as they are not on the Stellaris launchpad, you have to use USB_MODE_FORCE_DEVICE in the USBStackModeSet() function so that those pins are ignored.

    Regards,

    Sue

  • Ok I think I am begining to understand, so the Stellaris code isn't working because I don't have PB0 and PB1 set correctly (or is it actually PD7 since I am using Stellaris code and that is used for VBUS on the stellaris board)?

    Assuming that is correct and I don't use the USB_MODE_FORCE_DEVICE option what is the correct setting for PB0/PB1 (or PD7)? From a quick look at the USB spec I suspect I need to pull the ID pin (PB0) high?

     

  • Hi Jeff,

    I don't understand your reference to PD7.  What device are you using?  VBUS is always pinned out on PB1 with no other possible pin assignment.

    If you don't use the FORCE option, you must connect PB1/VBUS to the VBUS signal coming from the connector and connect PB0/ID to VDD.  You must also configure these pins correctly for USB operation using the GPIOPinTypeUSBAnalog function.

    Regards,

    Sue

  • I am trying to use code from a Stellaris Launchpad on a Tiva launchpad. I brought up PD7 because the Stellaris Launchpad schematic has this pin pulled to VBUS and the notes indicate "Used for VBUS detection" since the code was developed for a LM4F Stellaris launchpad I wasn't sure if the functions were hard coded to use PD7.

    On the Tiva Launchpad PB1 is connected to the VBUS signal from the connector (through a 0 ohm resistor) so I assume that prerequisite is met. PB0 however is not connected to VDD by default. So if I jumper this to Vdd that should allow this existing Stellaris code to work without modification?

    Sorry to be so dense and thanks for your help so far and in advance for your response!

  • Jeff,

    From the data sheet:

    However, when the USB controller is acting as a self-powered Device, a GPIO input or analog comparator input must be connected to VBUS and configured to generate an interrupt when the VBUS level drops. This interrupt is used to disable the pullup resistor on the USB0DP signal.

    I think you would benefit by spending some time reading the descriptions of operation as a device only or an OTG controller.

    You can jumper PB0 to VDD on your Tiva Launchpad to meet the requirement.

    Regards,

    Sue

  • Thanks for the info Sue, I tried the hardware solution and it doesn't work - looking at the board I believe its because R25 and R29 are not populated by default so the VBUS and VID pins aren't connected to PB0 and PB1 on a standard Tiva board, since you can't tackle it via hardware you must change the software to use the USB_MODE_FORCE_DEVICE option which does (as you indicated) fix it.

    That being said I think the various postings on the wiki and these forums where it indicates Stellaris Launchpad code should work "as is" are incorrect and should be updated- for example in this thread it is in actually stated in bold by a TI employee

    http://e2e.ti.com/group/universityprogram/educators/f/776/t/270596.aspx 

    Quote:

    This means that The Software is the same. 

    Any software that runs on the Stellaris LaunchPad will run on the Tiva LaunchPadHowever, if anything is written for the Tiva LaunchPad that uses features the Stellaris LaunchPad does not have (e.g. PWM) then the code will not work. 

     

    This statement does not appear to be correct to me. It should say 'most' software that runs on the Stellaris Launchpad will run on the Tiva Launchpad, if your labs or examples use the USB library the software will need to be modified due to the OTG functions of the new Launchpad chip (or something along those lines)

    If I am not understanding something let me know.

  • Jeff,

    You are correct this is an oversight on our part.  USB device code on the Stellaris LaunchPad can use DEVICE or FORCE DEVICE modes interchangeably since it is a device only part.  Tiva code must use FORCE DEVICE mode out of the box.

    It was my understanding that Stellaris LaunchPad code used FORCE DEVICE mode. I was mistaken.  

    Also of concern is that it appears that Tiva code also currently uses device mode and not FORCE DEVICE mode.  All users of a Tiva LaunchPad should either change the device software to force device mode or populate the missing resistors on PB0 and PB1.  Be aware that doing so may introduce 5V signals to boosterpacks on GPIO pins.  I cannot say for certain that the Tiva code as written running on a Tiva LaunchPad will work reliably. 

    I will file a bug against the Tiva code and see that it gets changed soon.  I think it is too late for version 1.1 of TivaWare.

    I apologize for the confusion and my mistake.

    Dexter

  • No problem, while it might not be apparent in the thread, I certainly appreciate the help with this and I think you guys do a great job with the forum!

    Not to confuse the issue too much but the TivaWare Launchpad example usb_dev_serial (C:\ti\TivaWare_C_Series-1.0\examples\boards\ek-tm4c123gxl\usb_dev_serial) uses the same DEVICE call (eUSBModeDevice) which according to the header notes "the ID pin must be pulled to a logic high value."  So I would expect it to have the same issue as the Stellariware serial example. However for some reason this project DOES work on a Tiva without the ID pin pulled high. As you said I think on a TIVA the examples should use eUSBModeForceDevice as a best practice but I'm surprised they somehow do work even without it.

    Either way I am good and am considering this resolved - For now I will update my Stellaris code to use the FORCE DEVICE option and work towards porting it to the new Tivaware USB library where I will use eUSBModeForceDevice since the ID pin is not connected.

    Thanks again for all the help!

  • Thanks Jeff.

    You got it exactly right on the TivaWare and eUSBModeForceDevice.

    I created a write up of this issue and the resolution on the WIKI to hopefully prevent others from finding it the hard way.

    http://processors.wiki.ti.com/index.php/Tiva_C_USB_Mode_Force_Device

    Dexter