This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RL-USB / Switch between several Devices

We plan to add USB support to a device (based on LPC2xxx).
User/Devicesoftware should decide if the device connects as Mass Storage, VCOM or both.
(similar found in several mobile phones "only charge","mass storage device","internet tethering" etc.)

Does the KEIL Usbd-Stack support such "switching"?
Is there any opensource usb stack already supporting this?

Any suggestions welcome..

Kindest regards

  • > Does the KEIL Usbd-Stack support such "switching"?

    The exposed interface of KEIL RL-USB library doesn't support run-time switch of USB configuration. If you would get the source code of the library, it isn't so difficult to modify the stack code to support run-time configuration switch.

    > Is there any opensource usb stack already supporting this?

    I'm not sure, if there is any one. Requirement of run-time config switch is not a major one. Also, the modification of USB stack for this purpose is not so difficult, if full source code of the stack would be open.

    To switch USB configuration, roughly speaking, your firmware should change these features.
    1) Descriptors
    2) Parser/handler of Class requests
    3) Endpoint process

    The outline of modification is,

    1) Descriptors
    The descriptors are sent to host when host puts Get_Descriptor request. In the process of this request, your firmware sends a descriptor of the current configuration.

    2) Parser/handler of Class requests
    When host puts a class request, it is passed to the target class of the interface number, specified by the SETUP data (usually, wIndex field). However, config switch changes interface number of target classes. Your firmware needs a thin process to resolve specified interface number to the target interface of current configuration.

    3) Endpoint process
    If your USB MCU has enough endpoints, you may assign unique endpoint(s) for each class, so that config switch doesn't affect to the endpoint number.

    Tsuneo