1 2 3 4 Previous Next 45 Replies Latest reply on Feb 17, 2020 1:16 AM by JayakrishnaT_76 Go to original post
      • 15. Re: CyCx3UvcAppUSBEventCB never executed
        MaSt_4567191

        Coding is YUY2 with 16bit per pixel to please UVC

        • 16. Re: CyCx3UvcAppUSBEventCB never executed
          JayakrishnaT_76

          Hello Marco,

           

          Please find my suggestions in the MIPI configuration Utility for your project

          - In the CX3 Receiver Configuration Tab, Change the Output Parallel Clock Divider from 8 to 4.

          - In the CX3 Receiver Configuration Tab, Change the FIFO Delay to 400.

           

          Also please confirm that the sensor is streaming data using 1 lane only.

           

          Once you set the new configuration, please save all the files. This will add the modified sources to the project. After this, please follow the steps given below:

          1. Ensure that you have added the sensor configuration settings for streaming the 720p video correctly.

          2. Did you change the DMA Buffer size in the project? I find that the DMA buffer size in this project is 0x8FF0. This is greater than 32KB which is described in the probe control structure in the uvcdscr.c file. Please change it to 0x5FF0 or 0x3FF0.

          3. Please make use of the API CyU3PMipicsiSetPhyTimeDelay(1,0x 07); just before CyCx3_ImageSensor_Set_1280x720(); function inside the function CyCx3UvcAppImageSensorSetVideoResolution() in uvc.c file. This is used for setting the PHY time delay. The same PHY time delay that is obtained from the CX3 Receiver Configuration Tab of MIPI Configuration Utility can be used for this. In your case it is 7. SO you can use 0x07 as the second parameter for the API CyU3PMipicsiSetPhyTimeDelay.

          4. Also, I find that the disable LPM API is used inside the DMA Callback where as in the example project that comes along with FX3 SDK (Cx3UvcOV5640), it is inside CyCx3AppStart() function. Please do not add any extra delay in the DMA Callback as there are possibilities that it can affect proper streaming of data. In fact, please do not modify the default project.

           

          You can refer to the following KBA to understand Steps to setup MIPI CSI Camera Solution with CX3.

          Steps to Setup up MIPI CSI Camera Solution with CX3 – KBA225748

          Please follow the steps exactly. Also, do not make any changes on the source files in the project unless it is mentioned in the KBA. 

           

          Please try the above recommendations and check whether the video is streaming properly.

           

          Best Regards,

          Jayakrishna

          • 17. Re: CyCx3UvcAppUSBEventCB never executed
            JayakrishnaT_76

            Hello Marco,

             

            Also, from the logs shared before, I saw that CyU3PI2cTransmitBytes() API was failing. This was shown as

            Write Failed @addr=0x1A

            Write Failed @addr=0x98E

             

            You mentioned that the writes are done Off line in the logs. Please confirm whether the sensor configuration settings were written properly.

             

            Best Regards,

            Jayakrishna

            • 18. Re: CyCx3UvcAppUSBEventCB never executed
              MaSt_4567191

              Hello Jayakrishna

              thanks much for your help, really appreciated. Yes the failures you reported are due to a disconnected I2C and must be ignored since sensor configuration is done by disconnecting the I2C from the CX3 of our system, using the CX3 house by the on semi eval board. We check that the sensor is correctly configured by using the On Semi client application running on a Win 10 PC

               

              I will try your suggestions ASAP and let you know

              • 19. Re: CyCx3UvcAppUSBEventCB never executed
                MaSt_4567191

                2. Did you change the DMA Buffer size in the project? I find that the DMA buffer size in this project is 0x8FF0. This is greater than 32KB which is described in the probe control structure in the uvcdscr.c file. Please change it to 0x5FF0 or 0x3FF0.

                 

                No I didn't ... I let the value generated during configuration in the header file

                 

                /*CX3_UVC_DATA_BUF_SIZE value of 0x8000 is compatible with 16-bit GPIF configuration;

                * When using Streamer for getting the video data CX3_UVC_DATA_BUF_SIZE has to be a

                * multiple of End point max packet size (1024), hence 0x8000 was chosen for CX3_UVC_DATA_BUF_SIZE when the application is non-UVC;

                * CAUTION: 0x6000 can be used and is compatible with both 16-bit/24-bit GPIF, but cannot be used for 720p;

                * 720p frame size is exact multiple of 0x6000, hence the frame end cannot be

                * detected with this value for 720p, since partial buffer does not exist in this case;

                 

                * When using UVC, 0x8FD0 for CX3_UVC_DATA_BUF_SIZE will work for 16-bit/24-bit GPIF configuration and for all resolutions

                * with 3 as CX3_UVC_STREAM_BUF_COUNT;

                */

                #ifdef UVC_APPLICATION

                #define CX3_UVC_DATA_BUF_SIZE                   (0x8FD0)

                #else

                #define CX3_UVC_DATA_BUF_SIZE                   (0x8000)

                #endif

                 

                I cannot locate 0x8ff0 anywhere. Please explain (which MACRO am I supposed to change)?

                 

                thanks

                • 20. Re: CyCx3UvcAppUSBEventCB never executed
                  JayakrishnaT_76

                  Hello,

                   

                  There was a small mistake in my last post. Apologies for that. Your payload size in probe control and DMA buffer size looks okay. Please ignore the second point in my previous response.

                   

                  Best Regards,

                  Jayakrishna

                  • 21. Re: CyCx3UvcAppUSBEventCB never executed
                    MaSt_4567191

                    4. Also, I find that the disable LPM API is used inside the DMA Callback where as in the example project that comes along with FX3 SDK (Cx3UvcOV5640), it is inside CyCx3AppStart() function. Please do not add any extra delay in the DMA Callback as there are possibilities that it can affect proper streaming of data. In fact, please do not modify the default project.

                     

                     

                    should I then comment out the CyU3PUsbLPMDisable() call in the CyCx3UvcAppDmaCallback? Please explain, this is sensitive real time code and I am scary of messing up everything

                    I think I did not add it ...

                     

                    BTW printflag is never asserted so I did a step back comparing to a former situation which shows attempts to stream data outside toward the USB , I just get

                     

                    bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

                    StpCB:In SET_FTR 0::1

                    bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                    bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                    bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                    bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                    bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                    bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

                    Writing Configuration Settings:

                    AplnStrt:SMState = 0x2

                    • 22. Re: CyCx3UvcAppUSBEventCB never executed
                      MaSt_4567191

                      update. After minutes I can see see video data on VLC player. It takes long time for this to happen.

                      Comments please? There is a Long Latency, donno understand why

                      • 23. Re: CyCx3UvcAppUSBEventCB never executed
                        JayakrishnaT_76

                        Hello,

                         

                        Apologies for another mistake, regarding LPMDisable(), you need not comment it out. I just found that in another example project that LPMDisable is called inside Prod_Event with the same delay.

                        Please send the USB traces using Wireshark or Lecroy Hardware analyzer traces (preferably).

                        Also, how much time is it taking to start the streaming of video and does it get stuck in between?

                        Are you seeing the same behaviour with a different host application?

                        I didnt understand clearly about the printflag which you mentioned in reply 21. Can you please make it more clear?

                         

                        Best Regards,

                        Jayakrishna

                        1 of 1 people found this helpful
                        • 24. Re: CyCx3UvcAppUSBEventCB never executed
                          MaSt_4567191

                          Apologies for another mistake, regarding LPMDisable(), you need not comment it out. I just found that in another example project that LPMDisable is called inside Prod_Event with the same delay.

                           

                          no problem for that

                           

                          Please send the USB traces using Wireshark or Lecroy Hardware analyzer traces (preferably).

                          Attached. I send the log while the UVC is streaming. Not sure what you will get from it. Plese sugegst some filtering or other options

                           

                          Also, how much time is it taking to start the streaming of video and does it get stuck in between?

                           

                          It takes minutes (maybe two) after the CX3 applicaion starts, open VLC player and see the movie .. if I then pause VLC it look like it neve restarts (it is 2:39 minute I am waiting now ....)

                           

                          Are you seeing the same behaviour with a different host application?

                           

                          So far with AMCap I cannot see the video starting at all ... all of this is so ... temperamental

                           

                          I didnt understand clearly about the printflag which you mentioned in reply 21. Can you please make it more clear?

                          It is a flag enabling thiese printouts

                          imeDiff = 1221 ms FPS = 24

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101521 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101522 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101523 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101524 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101525 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101526 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101527 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101528 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101529 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101530 Frm_Sz = 1843200 B

                          Prod = 50 Cons = 49  Prtl_Sz = 2400 Frm_Cnt = 101531 Frm_Sz = 1843200 B

                           

                          and this is the code

                           

                          #ifdef PRINT_FRAME_INFO

                          if (Printflag == 1)

                          {

                          /*For video streaming application of higher FPS refrain from using this debug print or try to reduce the print information*/

                          CyU3PDebugPrint(4,"\n\rProd = %d Cons = %d  Prtl_Sz = %d Frm_Cnt = %d Frm_Sz = %d B", TxCountflag, RxCountflag, PartialBufSize, FrameCount, ((TxCountflag*CX3_UVC_DATA_BUF_SIZE)+PartialBufSize));

                          Printflag = 0;

                          if (fpsflag == 1)

                          {

                          fps = 30000/(time1 -time0); //FPS calculate using time difference for 30 frames

                          CyU3PDebugPrint(4,"\n\rTimeDiff = %d ms FPS = %d", (time1 -time0), fps);

                          fpsflag = 0;

                          }

                          • 25. Re: CyCx3UvcAppUSBEventCB never executed
                            JayakrishnaT_76

                            Hello,

                             

                            I didnt find the USB logs in your previous reply. Please share the same.

                            Also, please check whether you are getting the same delay as that of the initial delay once you pause and restart the application.

                             

                            Best Regards,

                            Jayakrishna

                            • 26. Re: CyCx3UvcAppUSBEventCB never executed
                              MaSt_4567191

                              Actually I reprogrammed the CX3 with the same image but I cannot see video any longer ... sequence is

                              - close VLC

                              - reprogram and start CX3

                              - check that there is activity on the MPI input

                              - open VLC

                              - specify capure device as CX3-UVC

                              - play: I can see this on the teraterm log

                              bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                              bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                              bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                              bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                              bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                              bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

                              Writing Configuration Settings:

                              AplnStrt:SMState = 0x2

                              Then nothing happens ...

                               

                              The wshark log file is too large to attach here. for unknown reasons I cannot zip this ... let me retry

                              • 28. Re: CyCx3UvcAppUSBEventCB never executed
                                MaSt_4567191

                                3. Please make use of the API CyU3PMipicsiSetPhyTimeDelay(1,0x 07); just before CyCx3_ImageSensor_Set_1280x720(); function inside the function CyCx3UvcAppImageSensorSetVideoResolution() in uvc.c file. This is used for setting the PHY time delay. The same PHY time delay that is obtained from the CX3 Receiver Configuration Tab of MIPI Configuration Utility can be used for this. In your case it is 7. SO you can use 0x07 as the second parameter for the API CyU3PMipicsiSetPhyTimeDelay.

                                 

                                I make things slightly different: the video resolution is set during initialization at the end of AppInit in imagesensor.c reading the array of register address-value pair

                                 

                                static const CySensorReg16_t _baseConfigurationSettings16 [] =

                                {

                                ....

                                  {0xC856, 0x0000},    //cam_crop_window_yoffset = 0

                                  {0xC858, 0x0500},    //cam_crop_window_width = 1280

                                  {0xC85A, 0x02D0},    //cam_crop_window_height = 720

                                ...

                                };

                                 

                                _sz = (sizeof(_baseConfigurationSettings16_a))/(sizeof(CySensorReg16_t));

                                    _status = _writeConfigurationSettings_Reg16(devid, _baseConfigurationSettings16_a, _sz);

                                    if(_status != CY_U3P_SUCCESS)

                                    return _status;

                                 

                                which means the CyCx3_ImageSensor_Set_1280x720 do nothing since resoultuion has been set before

                                I call CyU3PMipicsiSetPhyTimeDelay(1,0x 07); jus befor initialization

                                • 29. Re: CyCx3UvcAppUSBEventCB never executed
                                  MaSt_4567191

                                  if I push sop on VLC

                                   

                                  bRType = 0x2, bRequest = 0x1, wValue = 0x0, wIndex = 0x83, wLength= 0x0

                                  bRType = 0xA1, bRequest = 0x87, wValue = 0x1400, wIndex = 0x100, wLength= 0xA

                                  bRType = 0xA1, bRequest = 0x81, wValue = 0x200, wIndex = 0x0, wLength= 0x1

                                  bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x100, wLength= 0x0

                                  StpCB:In SET_FTR 1::1

                                   

                                  If I then push start

                                   

                                  bRType = 0x1, bRequest = 0x3, wValue = 0x0, wIndex = 0x0, wLength= 0x0

                                  StpCB:In SET_FTR 1::1

                                  bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                                  bRType = 0x21, bRequest = 0x1, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                                  bRType = 0xA1, bRequest = 0x81, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                                  bRType = 0xA1, bRequest = 0x83, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                                  bRType = 0xA1, bRequest = 0x82, wValue = 0x100, wIndex = 0x1, wLength= 0x22

                                  bRType = 0x21, bRequest = 0x1, wValue = 0x200, wIndex = 0x1, wLength= 0x22

                                  Writing Configuration Settings:

                                  USB Setup CB:Call AppSTOP1

                                  AplnStop:SMState = 0x2

                                  AplnStrt:SMState = 0x2

                                   

                                  Pushing pause has no effect on teraterm screen

                                  Video is blank, though. It take 2-3 mins for popping up