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.

Running the MSP430 application without a host?

Other Parts Discussed in Thread: MSP430F5528, MSP430WARE, MSP430USBDEVPACK

Hi,

I need to develop a application for my msp430f5528 based custom hardware. My application works fine when i connect my hardware to any pc (host for CDC communication). Now i need to run a application even no host is connected (connected to powered hub, no CDC communication). 

I just need to develop a simple led blink application when there is no host connected. In my application, how can i predict, whether my device is connected to host or powered hub?


Regards,

Mano

  • If there is no enumeration request from host side, device should run as standalone. Of course, you must cover this possibility by your source code.
  • Hi Mano,

    You may want to check out the document Programmers_Guide_MSP430_USB_API.pdf. This document is found in your MSP430USBDEVPACK install - if you have CCS with MSP430Ware, this file is found in C:\ti\msp430\MSP430ware_1_95_00_32\usblib430\MSP430_USB_Software\Documentation. You can also navigate to this within CCS by going to View > Resource Explorer > MSP430ware > Libraries > USB Developers Package and click on Programmer's Guide to open the doc.

    In this document, see section 6.4, Detection of the Host via VBUS. There is a note here discussing the case where you may have a powered hub without a host present. In this case the USB state will enter ST_PHYS_CONNECTED_NOENUM_SUSP - your software would have to handle this state to tell your software to keep running its other code/decide that this is a powered hub rather than a host.

    I am wondering about your application - when someone goes from a powered hub (but no host), to connecting to a host - will the device be unpowered on VBUS in-between or not (will USB power be removed from the user e.g. disconnecting USB cable to the powered hub, and then re-applied by them connecting the USB cable now to an actual host)? I'm just trying to understand your use-case. My concern would be, if there is VBUS present the entire time and never disconnected in-between, then I'm not sure how you'd handle detecting that you now have a host - because usually the host detection happens by VBUS going from an off to an on state, and then trying to connect.

    Regards,
    Katie

  • Thanks for reply Katie,
    I referred the document, but the thing is that my application enters into ST_PHYS_CONNECTED_NOENUM_SUSP mode even if i connect the device with a active host. I hope it will be the initial state for all kind of usb connection (active host or power hub). Now suggest me how can i overcome this? I tried checking the connection state after giving some delay (enough delay time to enter into ST_ENUM_ACTIVE state), if the state is still in ST_PHYS_CONNECTED_NOENUM_SUSP then it is connected to a power hub otherwise an active host is connected. It is working but i am not sure on this logic, please suggest me.
    Regards,
    Mano
  • Hi Mano,

    In the same document that I mentioned before, the Programmer's Guide, there is a discussion of the ST_PHYS_CONNECTED_NOENUM_SUSP on p. 46 section 6.10. It discusses how when you try to enumerate on a connect, either enumeration will finish quickly and go to USB_ENUM_ACTIVE, or sometimes for several different reasons it may go to ST_PHYS_CONNECTED_NOENUM_SUSP - this depends on the behavior of the host. The section discusses things that can cause this (slow/busy host, etc).

    It then says that it will remain in this state until the host finishes enumeration (which it sounds like is what you see if you wait a bit longer). So, how you handle it is going to depend on your code and how you need your application to behave differently if it is on powered hub versus connected. You can put all your connected code in ST_ENUM_ACTIVE, and otherwise if you are in ST_PHYS_CONNECTED_NOENUM_SUSP do all the functions you'd normally do if you weren't connected. The code will be able to move states when the host finishes enumerating. The only possible issue would be if some of the functions you'd do while on a powered hub are things you need to not happen if you are connected to a host but waiting to enumerate - if that's the case maybe you'd want to add some extra handling like a delay before you determine you are just on a hub or something, for those hub-specific functions.

    Hopefully this helps give you some hints or ideas, but it's starting to get to where it's really going to depend on your end application and goals on how you need to handle this - so hopefully this gets you the right resources to make those decisions and try it out. The USB Programmer's guide is a great place to look for a lot of this information.

    UPDATE: See also section 11.8 of the usb programmer's guide - there is an example addressing this kind of issue - p. 98 and 99.

    Regards,

    Katie

**Attention** This is a public forum