1 2 3 4 Previous Next 46 Replies Latest reply on Jun 30, 2020 3:19 AM by HemanthR_06

    FX3 UVC stream stucked after several seconds

    LeGa_3963206

      Hi all,

       

      I have FX3 firmware that combines AN75779 (modified to receive 32-bit GPIF data) and USB-to-serial. I'm using SuperSpeedKit connected to Zeadboard which sends 120fps 800x480 test pattern. I made all required changes in descriptors and both parts seems to work well except that UVC stream stucks after several seconds of video capture.

       

      By "stucks" I mean that:

      1) threads stop running so that I don't see "UVC: Completed ..."  message anymore

      2) If I use on-board debugger, debug session also stops responding at all

      3) Capture software (Virtualdub/VLC) stop responding as no USB request are processed

       

      Couple additional notes:

      1) GPIF SM seems to continue to work because I toggle GPIO from GPIF callback and I can see it in scope.

      2) ARM error handlers are not called (put there GPIO toggle also) so it's not CPU issue or memory leak

      3) Suspend event not issued for no reason. I do LPM disable on UVC start and enable on UVC stop and return true in LPM CB exactly as in AN75779

       

      Will greatly appreciate for any help

        • 1. Re: FX3 UVC stream stucked after several seconds
          YashwantK_46

          Hello,

           

          I can see that you are using 3 threads at once and since when the application is struck and all the threads stop, we need to see which thread is being currently processed to understand what is being struck.

          So, please include debug prints in all the 3 threadentry functions at the starting to see which thread is being executed at a certain point of time.

           

          Also, can you please confirm if you have changed the DATA_COUNT_LIMIT and ADDR_COUNT_LIMIT values in the GPIF state machine according to your buffer value and GPIF bus width?

          The formula to update the buffer count value is as follows:

          According to your firmware, buffer size is 16KB and 32-bit bus width, so the count value would be:

          count = ((((16*1024)-16)/4) - 1) = 4091

           

          Please add the debug print as follows and please share the entire debug log with me so that i can see the point at which the thread is getting struck.

           

          Regards,

          Yashwant

          • 2. Re: FX3 UVC stream stucked after several seconds
            LeGa_3963206

            Hi,

             

            Yes, GPIF is configured as it should be. As I wrote I have video successfully received from FX3 by PC.

            Problem is that FX3 hangs after a while.

            I added debug messages to all three threads and changed EventGet parameter from WAIT_FOREVER to 1s so that the print stuff:

            • Thread UVCAppThread_Entry prints "UVCAppThread_Entry"
            • Thread UVCAppEP0Thread_Entry prints "UVCAppEP0Thread_Entry"
            • Thread USBUARTAppThread_Entry prints "UVC: Completed..." statistics message

             

            However it's still strange for me that when this "stuck" happens even debugger stops responding

             

            Attaching full log and updated sources.  As you may see all three threads stopped working.

             

            Regards,

            Leonid

            • 3. Re: FX3 UVC stream stucked after several seconds
              YashwantK_46

              Hello Leonid,

               

              Can you explain as to why you are using 3 threads in your UVC application?

              Please elaborate.


              Also, can you please test with the default UVC example project available with the app note AN75779 and see if you still see the issue?

               

              Is there a possibility for you to decrease the number of threads and then test and see if you notice any hanging issues in the firmware?

               

              Is the issue of freezing random or always happens at an exact point in the firmware execution?

               

               

              Regards,

              Yashwant

              • 4. Re: FX3 UVC stream stucked after several seconds
                LeGa_3963206

                Hi Yashwant,

                 

                In my firmware I combined two Cypress examples:

                 

                Here is my thread functionality:

                1) UVCAppThread_Entry handles UVC related requests (start/stop/suspend/dma reset) (as in AN75779)

                2) UVCAppEP0Thread_Entry handles video EP requests (control/stream) (as in UVC+USB2UART example)

                3) USBUARTAppThread_Entry handles UART dma wrap-ups. (as in UVC+USB2UART example)

                 

                AN75779 works perfect in my setup but it doesn't help to solve this issue

                 

                I already tried to reduce number of threads. I combined functionality of UVCAppThread_Entry and UVCAppEP0Thread_Entry but it still hangs

                 

                Freezing is random, but I looks like if I do many UVC start/stop it will hang sooner

                 

                Best regards,

                Leonid

                • 5. Re: FX3 UVC stream stucked after several seconds
                  LeGa_3963206

                  Hi,

                   

                  Another thing - I noticed that when in hanged state USB2UART DMA continue to work. So I guess it's just ThreadX who stopped working

                   

                  Best regards,

                  Leonid

                  • 6. Re: FX3 UVC stream stucked after several seconds
                    YashwantK_46

                    Hello Leonid,

                     

                    I already tried to reduce number of threads. I combined functionality of UVCAppThread_Entry and UVCAppEP0Thread_Entry but it still hangs

                    --> Does this mean that you currently have 2 threads in your application and it still hangs?

                     

                    I noticed that when in hanged state USB2UART DMA continues to work. So I guess it's just ThreadX who stopped working.

                    --> Can you please elaborate as to what you meant by DMA continue to work and can you confirm as to how you confirmed it?

                     

                    As an experiment, is it possible for you to include the functionality of UART DMA wrap-ups into the UVCAppThread_entry and see if you are able to see the freezing issue still happening?

                     

                    Regards,

                    Yashwant

                    • 7. Re: FX3 UVC stream stucked after several seconds
                      LeGa_3963206

                      Hi, Yashwant

                          

                      > Does this mean that you currently have 2 threads in your application and it still hangs?

                           Yes, exactly

                       

                      > Can you please elaborate as to what you meant by DMA continue to work and can you confirm as to how you confirmed it?

                           USB2UART uses two DMA channels - auto (usb3 -> UART) and manual (uart -> USB3). The Auto one continue to work during hanging      state, while manual one that depends on thread stops working.

                       

                      > As an experiment, is it possible for you to include the functionality of UART DMA wrap-ups into the UVCAppThread_entry and see if you are able to see the freezing issue still happening

                           Looks like we think the same way - I already tried it yesterday. So now I have one thread and it still hangs - no video, no uart-to-usb3, no debugger

                       

                       

                      Best regards,

                      Leonid

                      • 8. Re: FX3 UVC stream stucked after several seconds
                        YashwantK_46

                        Hello Leonid,

                         

                        Thank you for the confirmation regarding the firmware modifications done.

                         

                        "USB2UART uses two DMA channels - auto (usb3 -> UART) and manual (uart -> USB3). The Auto one continue to work during hanging      state, while manual one that depends on thread stops working."

                        --> Can you please confirm as to how you got to know that AUTO channel was working while the MANUAL channel stopped working?

                         

                        Can you please share you original firmware so that we can test it on our end and see if we can reproduce the issue here?

                        If you have any confidential sensor settings, you can exclude it out of your firmware, we will replace them with our default sensor settings and test it.

                         

                        Regards,

                        Yashwant

                         

                         

                        • 9. Re: FX3 UVC stream stucked after several seconds
                          LeGa_3963206

                          Hi Yashwant,

                           

                           

                          Can you please confirm as to how you got to know that AUTO channel was working while the MANUAL channel stopped working?

                               It's very simple - I have two serial terminals open. One is connected to UART pins of FX3, another one is connected to USB3 connector. During "hanging" stage when I send something through USB3 I still see data on UART as this channel is auto. But opposite direction doesn't work because it's manual and require thread to be running.

                           

                           

                          I'm attaching my full sources including GPIF designer files. There are no any confidential things in code because after all it's just two Cypress examples combined.

                          Please, note that I'm using 32-bit GPIF input with 100MHz clock on it.

                           

                           

                          Thanks,

                          Leonid

                           

                          • 10. Re: FX3 UVC stream stucked after several seconds
                            YashwantK_46

                            Hello Leonid,


                            Thank you for sharing your firmware.


                            I have a doubt about the uart_printf function in your firmware.

                            Where will this function print the data on?

                             

                            And why are using uart_printf() function instead of the CyU3PDebugPrint() API in your firmware?

                             

                            Regards,
                            Yashwant

                            • 11. Re: FX3 UVC stream stucked after several seconds
                              LeGa_3963206

                              Hi, Yashwant

                               

                              This function is not used because #define DEBUG_UART is commented

                               

                              Best regards,

                              Leonid

                              • 12. Re: FX3 UVC stream stucked after several seconds
                                YashwantK_46

                                Hello Leonid,

                                 

                                This function is not used because #define DEBUG_UART is commented

                                --> Are you enabling it when you are trying to debug the board? Or is it commented even then?

                                 

                                Also,

                                With the above firmware, did you see video stream atleast initially for some time?

                                If yes, can you please try below in the above firmware:

                                1. Increase the stack size for the thread.
                                2. Decrease buffer size for chHandleUSBSerial_OUT channel to 16 bytes.
                                3. Remove DmaChannelSetWrapUp for chHandleUSBSerial_OUT channel.

                                 

                                Please try the following and get back to me with the results.

                                 

                                Regards,

                                Yashwant

                                • 13. Re: FX3 UVC stream stucked after several seconds
                                  LeGa_3963206

                                  Hi Yashwant,

                                   

                                  --> Are you enabling it when you are trying to debug the board? Or is it commented even then?

                                  Yes, I uncomment it just for debug. It doesn't have impact on this issue.

                                   

                                  --> With the above firmware, did you see video stream atleast initially for some time?

                                  Yes, I see video for several seconds (usually about 10 seconds) and then it hangs

                                   

                                  1. Increased stack size form 0x1000 to 0x4000 - still hangs

                                  2. Decreased buffer size to 16b - still hangs

                                  3. Removed DMA wrap-ups - still hangs

                                   

                                   

                                  Best regards,

                                  Leonid

                                  • 14. Re: FX3 UVC stream stucked after several seconds
                                    LeGa_3963206

                                    Hi Yashwant,

                                     

                                    Are there any updates?

                                    Were you able to reproduce the issue?

                                     

                                    Best regards,

                                    Leonid

                                    1 2 3 4 Previous Next