1 Reply Latest reply on Aug 9, 2017 12:12 AM by rghe

    Managing multiple configurations

    davide.bozzato

      Hi all,

         

      I'd like to know how to proceed to manage multiple configurations to have self/bus powered profiles.

         

      I already modified the USB descriptors in order to have 2 configuration but is seems that CyU3PUsbSetDesc function only register the last one (as its description cryptically suggest...).

         

      If the hw need to change configuration (eg. the external power is missing), do I have to use CyU3PConnectState to disable USB connection, register the new configuration with CyU3PUsbSetDesc, and enable USB connection again? (Re-enumeration)

         

      In this case, should the USB descriptors explicitly declare 2 different configuration descriptor (Number of configurations = 2 into Standard Device Descriptor) ?

         

      Thanks

        • 1. Re: Managing multiple configurations
          rghe

          Hi,

             


          Whenever you want to change the configuration, you need to re-enumerate the device with the new configuration (Disable the USB connection, register a new configuration and enable the USB connection)

             


          If you are using any one of the two configurations at a time, the Number of configurations field of Standard Device descriptor has to be set to 1. However, you need to declare both the configurations in the USB descriptor file and select the configuration by passing appropriate configuration to CyU3PUsbSetDesc() API depending on the profile.

             


          Suppose you have two Configuration descriptors CyFxUSBHSConfigDscr1 and CyFxUSBHSConfigDscr2. Now, in one of the modes, you want to select the Configuration descriptor CyFxUSBHSConfigDscr1. In this case, you need to call the CyU3PUsbSetDesc() API as: CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_CONFIG_DESCR, 0, (uint8_t *)CyFxUSBHSConfigDscr1); When you want to switch to the other configuration, you need to call the CyU3PUsbSetDesc() as: CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_CONFIG_DESCR, 0, (uint8_t *)CyFxUSBHSConfigDscr2);