5 Replies Latest reply on Sep 27, 2018 3:46 AM by lulec_3660966

    Cx3 UVC - issue in UART comm

      Hi,

      I have been working with a camera. I have used the UART in the CX3 for communicating with another board (in Reg mode). The UART communication takes place in a separate thread with a timeout of 1 sec(set using the CyU3PUartSetTimeout() API). During successful UART communication no problem is observed. But  whenever there is a failure in the UART comm (i.e API returns TIMEOUT error) the streaming gets paused (or reduced to 1 r 2 fps in some cases) for 1- 2 secs and then continues normal operation. UART comm and UVC transfer are done in separate threads. Is there  any way to prevent the UART communication from affecting the UVC thread??

       

      Thanks in Advance,

      Regards,

      Ashlin Surey. A

        • 1. Re: Cx3 UVC - issue in UART comm

          If you check the API guide/comments just before the CyU3PUartSetTimeout() API, you will see this note:

          "The API keeps the CPU spinning until the data transfer is completed, or the specified timeout period has elapsed. Therefore, it is not desirable to set a very large timeout for these operations."

           

          It is not advisable to use this API with large timeout. One way to do this is to have a less timeout in CyU3PUartSetTimeout() API (Assume 10ms instead of 1 sec) and then do a CyU3PUartTransmitBytes/CyU3PUartReceiveBytes. If the API times out call CyU3PThreadSleep(10) and retry. This way your normal video stream won't stop.

           

          Please check if it helps.

          1 of 1 people found this helpful
          • 2. Re: Cx3 UVC - issue in UART comm

            Hi savj,

            Thanks for your reply. I will try this and get back to you.

             

            Regards,

            Ashlin Surey. A

            • 3. Re: Cx3 UVC - issue in UART comm

              Hi Ashlinsurey:

               

                   Has your problem been solved?

                   Now we seem to have encountered the same problem as you.After a few days analysis, we found that using CyU3PUartTransmitBytes will result in a long delay time.This directly leads to video transmission jams and dropped frames.In addition, I don't know how to get CyU3PUartTransmitBytes to return TIMEOUT error message.

                   Can you tell me how you solved this problem?Maybe I can get the right solution from your experience.Thank you!

                  

              Best regards,

              Luca

              • 4. Re: Cx3 UVC - issue in UART comm

                Hi Luca,

                We solved our problem by reducing the uart timeout value to 1 ms (which is more than enough for our usecase). After reducing the timeout value,we didn't face any issues. FYI, We too didn't receive timeout error from TransmitBytes API and our issue was related to RecevieBytes API only which got solved after changing the timeout value. Also note that  CyU3PUartSetTimeout()  API is supported in FX3 SDK 1.3.3 and above versions only.

                 

                Regards,

                Ashlin Surey. A

                • 5. Re: Cx3 UVC - issue in UART comm

                  Hi Ashlinsurey:

                   

                       Thank you for your reply.

                       I have solved this problem.I also applied the method of reducing the uart timeout value at the beginning.But if I used this method under my project,I found that this would be very serious loss of serial data.So I have to change the register mode to the DMA mode.And this will make device works very well!

                       Thank you again for your reply.

                   

                  Best regards,

                  Luca