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

Is RL_USB possible to create composite deivce on runtime

Hi

Our system has a USB device port and SD card slot, the SD card is optional, so there are 2 cases:

1. Connect the USB to PC, it needs to be a HID device.
2. Insert SD card, then connect USB to PC, it needs to be a HID+MSC composite device.

I am using RL_USB, this means I need 2 usb configuration: one for single HID device, the other for composite HID+MSC device, firmware needs to detect if sd card is inserted to decide which configuration to enable. However, it seems I can only config the usb class in compile time, and not able to change it in runtime??

Am I right? What's the general solution for this requirement? I am using RL_USB library.

Thanks.

Parents
  • > Don't know if this is the general solution.

    It's the Windows way.

    As of configuration change using soft-detach,
    Windows WRONGLY assume single configuration for each USB device, though USB spec allows multi-configurations. To switch configuration on Windows, soft-detach / attach is used as the last resort. In this case, you have to assign different VID/PID (at least, PID) to the new configuration, because Windows ASSume single configuration for each VID/PID.

    Tsuneo

Reply
  • > Don't know if this is the general solution.

    It's the Windows way.

    As of configuration change using soft-detach,
    Windows WRONGLY assume single configuration for each USB device, though USB spec allows multi-configurations. To switch configuration on Windows, soft-detach / attach is used as the last resort. In this case, you have to assign different VID/PID (at least, PID) to the new configuration, because Windows ASSume single configuration for each VID/PID.

    Tsuneo

Children
  • Yes, I want this solution: use 2 configurations, and use soft-reset to select different configuration, but problem is: does RL_USB library support this? I can't see any usbd_xxx functions to change configuration in runtime, seems I can only make one configuration in the USB_Config.c source file, then compile to one single static configuration!

    I guess I must change RL_USB source code instead of using the RL_USB.Lib of CM3? But the source code is not provided in MDK4.20, I must copy these source code from early version of RL_ARM? Don't know if there is license problem.

  • > does RL_USB library support this?

    No. You have to rewrite the library source code.

    On the config switch scheme, HID connection is disturbed, every time SD card is inserted/removed. I don't think it's a decent implementation.

    Tsuneo