1 2 Previous Next 26 Replies Latest reply on Mar 12, 2020 3:21 AM by GiSa_4520796

    Can we pass vendor requests without using control center

    saku_4625426

      Hello Community,

       

      Can we pass vendor requests without using control center i.e..,can we make it automatic in code itself?

      Let me know whether this is possible or not.

       

      Regards,

      Sai.

        • 1. Re: Can we pass vendor requests without using control center
          YashwantK_46

          EDITED:

           

          Hello Sai,

           

          You can always automate code by using flags and then checking on them and once the flag is set, performing the action that you want to perform.


          The main action that needs to be performed should be added in the for (;;) loop such that the condition will always check on the value of the flag.

           

          Also, you can use the host application to send the vendor commands to the device. You can refer to Section 9.3 of the document (Standard USB Device Requests): https://www.usb3.com/whitepapers/USB%203%200%20%2811132008%29-final.pdf

           


          Regards,

          Yashwant

          • 2. Re: Can we pass vendor requests without using control center
            saku_4625426

            Hello,

             

            Thanks a lot for your quick reply.

             

            I am mentioning my application clearly for correctness

             

            I want to program FX3 into SPI Flash (Booting) and not to send vendor requests explicitly in Control Center.Whenever there exists a newly  sampled data in P-Port of FX3,it should be able to write into SD Card(Whenever needed We can read it using host application).This is what I am thinking to do.Is this Possible or not?

             

            I have gone through the above document and assuming that above mentioned application can be implemented.

             

            Do you have any piece of code about how to pass those(In Doc) values in main application for my reference?

             

             

            Regards,

            Sai.

            • 3. Re: Can we pass vendor requests without using control center
              saku_4625426

              Hello,

               

              Please do reply for my previous response.

               

              Regards,

              Sai.

              • 4. Re: Can we pass vendor requests without using control center
                saku_4625426

                Hello,

                 

                As mentioned in table 9.2 of given document as attached,how to give those values in main function.( D7 - 1 , D6..5 -  2(11)  -> vendor , D4..0 -  0(00000) -> device )

                 

                D[7:0] -> 11100000

                 

                I want to select below configuration in Control Center

                Direction     -     out

                Req Type    -     Vendor

                Target         -     Device

                 

                Regards,

                Sai.

                • 5. Re: Can we pass vendor requests without using control center
                  YashwantK_46

                  Hello Sai,

                   

                  Can you tell me what is the final image size or the data size that the PIB block will commit to the SIB block?

                   

                  I need this information to try and understand making your code autonomous.


                  Regards,
                  Yashwant

                  • 6. Re: Can we pass vendor requests without using control center
                    saku_4625426

                    Hello,

                     

                    As of now my image pixel size is 640*480 and it is of 4KB and later on we will increase both resolution and size if this starts working.

                     

                    Regards,

                    Sai.

                    • 7. Re: Can we pass vendor requests without using control center
                      saku_4625426

                      Hello,

                       

                      Please let me know how to include that requests in main function or provide me any reference code for the same so that I can implement in my firmware.Waiting for your reply.

                       

                      Regards,

                      Sai.

                      • 8. Re: Can we pass vendor requests without using control center
                        YashwantK_46

                        Hello Sai,

                         

                        Can you please clarify what you mean by "my image pixel size is 640*480 and it is of 4KB" ?

                         

                        If you take the pixel size into consideration, total size would be 640*480*pixel_depth (let's say 1Byte/Pixel) = 307200 Bytes/1024 = 300KB which is not equal to 4KB.

                         

                        Please tell us the exact image size that you want to store in the SD card so that I can modify the firmware on my end.


                        Regards,
                        Yashwant

                        • 9. Re: Can we pass vendor requests without using control center
                          saku_4625426

                          Hello,

                           

                          My exact image size is 640*480 and if it works for 640*480,I need to change the pixel size for 752*480.

                           

                          And your calculation is exactly correct,according to pixel size we have to change buffer size. Correct?

                           

                          Regards,

                          Sai.

                          • 10. Re: Can we pass vendor requests without using control center
                            YashwantK_46

                            Hello Sai,

                             

                            Please perform the firmware modifications as suggested by me and get back to me with the results.

                             

                            Regards,

                            Yashwant

                            • 11. Re: Can we pass vendor requests without using control center
                              GiSa_4520796

                              Hello,

                               

                              As you suggested I am modifying my firmware for removing vendor requests in my application.I commented the vendor requests declaration in firmware and trying to add the below snippet.Am I doing correct or not?Please let me know if this is wrong.

                               

                                  if (evt == CY_U3P_DMA_CB_XFER_CPLT)

                                        {

                               

                                             if(status == CY_U3P_SUCCESS)

                                  

                                                {

                                

                                                       status = CyU3PSibReadWriteRequest (CY_FX_SIB_WRITE, 0,glLunUnit[0], 8, (uint32_t)blkadd, 0);

                                                       if (status != CY_U3P_SUCCESS)

                                                            {

                                                       /* Abort the DMA Channel */

                                                        CyU3PDmaChannelReset (&glChHandleMscIn);

                                                            }

                               

                               

                                                        status = CyU3PSibReadWriteRequest (CY_FX_SIB_READ, 0,glLunUnit[0], 8, 2, 1);

                                                        if (status != CY_U3P_SUCCESS)

                                                             {

                                                        /* Abort the DMA Channel */

                                                        CyU3PDmaChannelReset (&glChHandleMscIn);

                                                             }

                               

                                                       //SIB_XFER

                               

                                                  }

                                        }

                               

                              Regards,

                              Srujana.

                              • 12. Re: Can we pass vendor requests without using control center
                                GiSa_4520796

                                Hello,

                                 

                                Waiting for your reply.

                                 

                                Regards,

                                Srujana.

                                • 13. Re: Can we pass vendor requests without using control center
                                  GiSa_4520796

                                  Hello,

                                   

                                  When i added the above snippet as mentioned in my previous response,the device is enumerating succesfully.But it is not going into the loop(I checked by adding DeviceReset over there).What modifications should be done still?

                                   

                                  Regards,

                                  Srujana.

                                  • 14. Re: Can we pass vendor requests without using control center
                                    YashwantK_46

                                    Hello Srujana,


                                    1.) Have you changed the second parameter's value in CyU3PDmaChannelSetXfer() to 150KB as suggested previously?

                                    If not, replace apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleMscIn, 0); to

                                                                       apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleMscIn, 153600);               //150KB

                                     

                                    2.) In the channel creation,  if you are using a USB2.0 connection, change the buffer size to 512 * 15 and count to 20 to make it 150KB.

                                    If you are using USB3.0 connection, change the buffer size to 1024 * 15 and count to 10 to make it 150KB.

                                    This is necessary to get the entire 150KB image data into the buffers.

                                     

                                    3.) In the DMA callback for the, in PROD_EVENT, the buffers will be committed based on the USB speed, either 10 or 20 and will reach the SIB block buffers.

                                    4.) In the CyFxMscApplnDmaCb(), under the case CY_U3P_DMA_CB_PROD_EVENT:, once committing is done, increment a variable and when that variable comes equal to the buffer count, either 10 or 20, based on the USB speed, set a flag like below:

                                        

                                    uint8_t prod = 0;                                                                      //Declaration

                                    CyBool_t prodSet = CyFalse;                                                  //Declaration

                                     

                                     

                                    5.) Now check for this flag, prodSet in for (; ; ) loop and when it is set, call the CyU3PSibReadWriteRequest () to write it to SD card.

                                    6.) Once all the data is written to the SD card. the CY_U3P_SIB_EVENT_XFER_CPLT event will be set in the CyFxMscApplnSibCB() function.

                                    7.) In the callback, when (evt == CY_U3P_SIB_EVENT_XFER_CPLT), you will have to again call CyU3PDmaChannelSetXfer () just like below:

                                          apiRetStatus = CyU3PDmaChannelSetXfer (&glChHandleMscIn, 153600);               //150KB

                                     

                                    You don't need to use the CY_U3P_DMA_CB_XFER_CPLT event since this event is triggered only when the data is read from the buffers.

                                    Please do as mentioned and update me with the results.


                                    Regards,
                                    Yashwant

                                    1 2 Previous Next