12 Replies Latest reply on Nov 18, 2019 2:42 AM by BBKi_4523881

    fx3 multi configuration

    BBKi_4523881

      Hi,

       

      I am trying to expand the bulk loop example so that the firmware to contain additional configurations.

        

      I duplicated the CyFxUSBHSConfigDscr array in cyfxbulklpdscr.c to and changed the configuration number and number of configurations on the device descriptor.

      a "stall" is returned when the host tries to configure the device (set-configuration).

       

      do you have any ideas or code examples for this issue?

       

      thanks,

      Gal

        • 1. Re: fx3 multi configuration
          RashiV_61

          Hello,

           

          Please confirm that you made all these changes:

           

          - Changes the number of configurations in Device Descriptor (   0x02   /* Number of configurations */   )

          - Copied the CyFxUSBHSConfigDscr structure with some other name ( const uint8_t CyFxUSBHSConfigDscr1[] __attribute__ ((aligned (32)))

          - Changed  the Configuration number in the new structure (    0x02,   /* Configuration number */)

          - Changed the index number in the new structure ( 0x01,   /* COnfiguration string index */)

          - Add the extern variable in the (.h) file  (extern const uint8_t CyFxUSBHSConfigDscr1[];)

          - Sent the descriptor with index number in the (.c) file

          (apiRetStatus = CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_CONFIG_DESCR, 1, (uint8_t *)CyFxUSBHSConfigDscr1) )

           

          Both the configuration won't be seen in the Windows Device manager. You host application should have provisions to switch between the configurations.

           

          Please let me know if any other queries.

           

          Regards,

          Rashi

           

          • 2. Re: fx3 multi configuration
            BBKi_4523881

            Hi Rashi,

            Thanks for your answer!

             

            I have done all those steps in the first place, my problem is to switch to the second configuration.

             

            How do I load the other descriptor?

             

            Thanks,

            Gal

            • 3. Re: fx3 multi configuration
              RashiV_61

              Hello Gal,

               

              For selecting the Configurations URB needs to sent from the Host side

              Please refer How to select a configuration for a USB device - Windows drivers | Microsoft Docs

               

              Regards,

              Rashi

              • 4. Re: fx3 multi configuration
                BBKi_4523881

                Hi,

                 

                sorry, my question wasn't so clear.

                I'm using libusb and I konw how to switch configuration (set_configuration command).

                my question is:

                what do I need to do after the case CY_U3P_USB_EVENT_SETCONF?

                at the moment I'm doing CyU3PUsbSetDesc(CY_U3P_USB_SET_HS_CONFIG_DESCR, 1, (uint8_t *)CyFxUSBHSConfigDscr1); but it's seems not to be enough for loading the descriptor and switching to this configuration.

                 

                thanks,

                Gal

                • 5. Re: fx3 multi configuration
                  RashiV_61

                  Hello,

                   

                  Please refer to this thread which explains the procedure need to be carried out while switching the configuration Managing multiple configurations

                   

                  Regards,

                  Rashi

                  • 6. Re: fx3 multi configuration
                    BBKi_4523881

                    Hi  Rashi,

                     

                    thanks for your assistant.

                    another fundamental question regards this issue:

                     

                    If I have 2 descriptors no matter what I'm doing I revive Stall on the set configuration. ( using Lecroy recording)

                    I've tried to do  

                        case CY_U3P_USB_EVENT_SETCONF:

                        CyU3PUsbAckSetup ();

                     

                    but unsuccessful, do you have any idea why?

                     

                    thanks,

                    Gal

                    • 7. Re: fx3 multi configuration
                      RashiV_61

                      Hello,

                       

                      Assuming that you are following this thread Managing multiple configurations, just comment out CyU3PUsbAckSetup ();

                       

                      CY_U3P_USB_EVENT_SETCONF this is just an event and not a standard request. This is just to notify the firmware that setconf has been done. so you can't send an ACK. There will be a stall as without any request by the host the device is sending ACK  on the bus.

                       

                      Regards,

                      Rashi

                       

                       

                      • 8. Re: fx3 multi configuration
                        BBKi_4523881

                        Hi,

                         

                        as far as I understand I followed all steps mentioned in your answer (and the managing multiple configuration thread).

                        please have a look at my code below and tell me if you find why I receive STALL for the set configuration standard request.

                         

                        many thanks,

                        Gal

                         

                        p.s.

                        in this code I didn't even tried to switch configuration, only to load the second conf at first place. even for that I revived STALL.

                        • 9. Re: fx3 multi configuration
                          RashiV_61

                          Hello,

                           

                          Please try programming the attached firmware.

                          I have made changes to the bulksrcsink firmware as per the Managing multiple configurations . Let me know if it works. I have made changes only for high speed descriptors.

                          GPIO[10] is used to switch the configurations in this firmware. whenever there is a positive edge detected at the GPIO[10] / DQ10, the usb will be stopped and and restarted with different descriptors.

                          - First test by keeping GPIO[10]  LOW, check whether device is seen as FX3 Streaming Device

                          - Then, in continuation to first point, supply GPIO[10] with 3.3V. You will see the enumeration again.

                           

                          To know which configuration is selected i have changed one field in both the configurations

                          0x80,                          /* Config characteristics - bus powered */

                          0xC0                              /*Self Powered */

                           

                          I have also attached wireshark traces. Please refer.

                           

                          You want to work with one configuration at a time. Is my understanding right?

                           

                          Regards,

                          Rashi

                          • 10. Re: fx3 multi configuration
                            BBKi_4523881

                            Hi,

                             

                            thank you for your assistance but I think we doesn't speak about the same thing.

                            regards your question:

                            "You want to work with one configuration at a time. Is my understanding right?"

                            the answer is no. I want to load device that have 2 or more configuration at the same time. this is why I've  changed

                            /* Number of configurations */    to     0x02

                            can you supply code example of device with 2 configuration

                             

                            many thanks in advanced,

                            Gal                        

                            • 11. Re: fx3 multi configuration
                              RashiV_61

                              Hello,

                               

                              Please find the attached firmware, which doesn't use fast enumeration  CyU3PUsbRegisterSetupCallback(CyFxBulkLpApplnUSBSetupCB, CyFalse); by setting second parameter to CyFalse. Due to this  the  application handles all the setup packets.

                               

                              The application is passing two different configuration (High speed configurations). Please check it at your end by probing the USB lines.

                              Let me know the results

                               

                              I have checked it at my end.  Please refer to the USB traces attached

                               

                              Regards,

                              Rashi

                              • 12. Re: fx3 multi configuration
                                BBKi_4523881

                                Hi,

                                 

                                this solution seems to work!

                                 

                                thanks a lot,

                                Gal