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 VBUS detect pin on Stellaris Launchpad?

Hi!

It looks like USB_EVENT_DISCONNECTED does not fire on my Stellaris Launchpad. The USBlib guide states that PB1 is used for VBUS detection but looking at the Stellaris Launchpad Schematics it looks like PD7 is used there. Might this be the problem and where can I change this pin in the software?

Thanks,

Anguel

  • Hi Anguel,

    The LM4F120H5QR MCU on the Stellaris LaunchPad is a device-only USB controller.  VBUS monitoring is not implemented (or required) on this part.  The connection shown to PD7 is just a regular I/O connection, that intended to be used at the application-level for simple USB power-present sensing when self-power is an option.  Just read PD7 as a digital input.

     

  • Jonathan,

    Thank you for the reply. I know that the MCU only supports USB device mode. But I do not agree that VBUS monitoring is not required. Any self-powered USB device must be able to detect that it has been disconnected from the host during operation. I wasted too much time to find out that USB_EVENT_DISCONNECTED simply did not fire in your USB example code. There was no hint in the code that it might not work on some devices.

    So do I understand correctly that I have to fire my own GPIO interrupt on PD7 and check for VBUS and use it as my own USB_EVENT_DISCONNECTED callback? Or does your driver also perform other internal stuff on devices that support VBUS monitoring that I would have to mimic in my GPIO interrupt? In the datasheet of another of your MCUs I read: "For proper self-powered Device operation, the VBUS value must still be monitored to assure that if the Host removes VBUS, the self-powered Device disables the D+/D- pull-up resistors."

    Please clarify EXACTLY what I have to do on the Stellaris Launchpad board to get this to work PROPERLY. I am tired of the bad docs and in the forums I additionally read that there are some Errata on the Cortex M3 devices which confuses me even more. So please let me know how to get a self-powered USB device to work properly with this board.

    Thanks in advance,

    Anguel

  • I append my experience with LM4F232..ver. A3.

    My app is borned on LM4F232 eva board, with full USB connection, USB as device: the EVENT_DISCONNECT happens.

    Then my new PCB have only DP and DM connected, VBUS not connected, app setups USB as DEVICE, USB routine don't change : EVENT_DISCONNECT doesn't happen!

    Now I have the problem to know when USB are disconnected !!

    Pls someone tell us how to check the USB disconnection !

    thks.

     

     

  • Marco,

    On the LM4F232 you have a fully-featured USB controller. Of course you need to connect VBUS on PB1 for monitoring, otherwise you cannot catch the disconnect event.

    On the LM4F120 of the Stellaris Launchpad however, VBUS monitoring must be done through GPIO interrupts. I still hope that someone can give me some hints how this should be done PROPERLY. 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?

    When VBUS is present, should I then call the USBDCDInit() function and when VBUS is lost (caused by a USB cable disconnect) I should call USBDCDCTerm() so that the self-powered Device has to disable the D+/D- pull-up resistors?

    Regards,

    Anguel

  • ...to continue my "monologue":

    Today I tried calling the USBDCDCTerm() but it looks like this completely shuts down the USB controller, even the debugger cannot access the USB registers after that.

    Probably setting the SOFTCONN bit in the USB POWER register is the way to go but I could not find any such function or information about this in the StellarisWare USBLIB guide.

    Anguel

  • In my project, the evolution step is to switch to LM4F120 with USB only device,

    then in any case this problem is also my problem.

    Emulating I find that there is a counter that increments only when an USB connection is established: number of frame.

    With  ROM_USBFrameNumberGet()   I check if that counter is rolling or not: if not, after time and logical filter, I choose that USB connection are terminated.

    Testing it seems work fine......

     

  • Regarding my original question, there is now a solution in this SYS/BIOS thread:

    http://e2e.ti.com/support/embedded/bios/f/355/p/250337/876048.aspx

    Many thanks to Tom Kopriva for the workaround.

    Marco, the solution for your problem sounds very innovative but only the experts here can tell you if it is also reliable.

    Regards,

    Anguel

  • For a discussion on the SOFTCONN bit see this post:

    http://e2e.ti.com/support/microcontrollers/stellaris_arm/f/901/t/251938.aspx

  • Hi Marco,

    Host stops SOF in Suspend - The host PC goes in sleep, or PC driver drops the target device in selective Suspend. The device should keep connection in Suspend.

    LM4F120H5QR on Stellaris Launchpad doesn't have dedicated VBUS detection pin.
    Self-powered device should assign a GPIO pin, like PD7 on Launchpad, for VBUS sense. Firmware disables on-chip D+ pull-up by USBPOWER.SOFTCONN bit, while VBUS voltage is absence, like Tom Kopriva solution.

    Anyway, SOFTCONN bit should be renamed on this part, because VBUS monitoring function is lost.

    Tsuneo

  • Tsuneo Chinzei said:

    Self-powered device should assign a GPIO pin, like PD7 on Launchpad, for VBUS sense. Firmware disables on-chip D+ pull-up by USBPOWER.SOFTCONN bit, while VBUS voltage is absence, like Tom Kopriva solution.

    Unfortunately, Tom Kopriva's solution does NOT use the SOFTCONN bit to disable pull-ups. Instead in the VBUS ISR it calls USBDCDTerm() to shut down the complete USB controller and then IMMEDIATELY (still in the ISR) reinitializes the USB controller by calling USBDCDCInit() and StellarisWare auto-sets SOFTCONN to 1 (not 0) when this is done, so the pull-up remains enabled, although the device is not connected anymore, this is NOT compliant with the USB specs as far as I see:

    Void USB_Disconnect_ISR(Void)
    {
        GPIO_clearInt(LM4F120H5QR_GPIO_USB);

        USBDCDTerm(cdcInstance);

        /* State specific variables */
        state = USBCDCD_STATE_UNCONFIGURED;

        cdcInstance = (ULong) USBDCDCInit(0, &serialDevice);
        if (!cdcInstance) {
            System_abort("Error initializing the serial device");
        }
    }



    Anyway, SOFTCONN bit should be renamed on this part, because VBUS monitoring function is lost.

    I do not quite understand this. I thought that SOFCONN can be manually set or cleared, e.g. in the VBUS ISR. Unfortunately, this functionality is not automatically added at this time in StellarisWare.

    Anguel