2 Replies Latest reply on Jan 6, 2018 12:50 AM by decai.wang_2529456

    where is CX3_ERROR_THREAD in UVC demo code?

    decai.wang_2529456

      Dear Sir,

       

      I wan to to debug mipi block in CX3 ,for example, those counts error in mipi block, because video disappears occasionally. I enable these two MACRO

       

      /* Uncomment the following line to provide verbose debug logging. */

      #define CX3_DEBUG_ENABLED       1

       

      /* Uncomment the following line to run the mipi error thread */

      #define CX3_ERROR_THREAD_ENABLE 1

       

      I had seen this mipi-error thread code in other uvc.c(thread create location) , But I cannot find mipi-error thread in my uvc.c , it is generated by eclipse suite.

       

      Can anybody tell me why?

       

      Thanks.

       

      David

       

       

      The following section is from uvc.c

       

      /* Application define function which creates the threads. */

      void

      CyFxApplicationDefine (

              void)

      {

          void *ptr = NULL;

          uint32_t apiRetStatus = CY_U3P_SUCCESS;

       

       

          /* Allocate the memory for the thread and create the thread */

          ptr = CyU3PMemAlloc (UVC_APP_THREAD_STACK);

          if (ptr == NULL)

              goto StartupError;

       

       

          apiRetStatus = CyU3PThreadCreate (&uvcAppThread,    /* UVC Thread structure */

                  "30:UVC_app_thread",                        /* Thread Id and name */

                  CyCx3UvcAppThread_Entry,                    /* UVC Application Thread Entry function */

                  0,                                          /* No input parameter to thread */

                  ptr,                                        /* Pointer to the allocated thread stack */

                  UVC_APP_THREAD_STACK,                       /* UVC Application Thread stack size */

                  UVC_APP_THREAD_PRIORITY,                    /* UVC Application Thread priority */

                  UVC_APP_THREAD_PRIORITY,                    /* Pre-emption threshold */

                  CYU3P_NO_TIME_SLICE,                        /* No time slice for the application thread */

                  CYU3P_AUTO_START                            /* Start the Thread immediately */

                  );

       

       

          /* Check the return code */

          if (apiRetStatus != CY_U3P_SUCCESS)

              goto StartupError;

       

       

          /* Create GPIO application event group */   

          if (CyU3PEventCreate(&glCx3Event) != CY_U3P_SUCCESS)

              goto StartupError;

      #ifdef STILL_CAPTURE_ENABLE

      /* Create GPIO application event group for still image related events */

      if (CyU3PEventCreate(&glStillImageEvent) != CY_U3P_SUCCESS)

      goto StartupError;

      #endif

       

       

       

       

       

       

          return;

       

       

      StartupError:

          {

              /* Failed to create threads and objects required for the application. This is a fatal error and we cannot

               * continue.

               */

       

       

              /* Add custom recovery or debug actions here */

       

       

              while(1);

          }

      }

        • 1. Re: where is CX3_ERROR_THREAD in UVC demo code?
          decai.wang_2529456

          Dear SIr,

           

          I add    CyU3PMipicsiGetErrors( CyTrue, &errCnts) in DMA_RESET_EVENT processwhen cb failure occurs ,errCnts = 257, 0x101(hex)

          Can anyone tell me what meaning for this value?

           

          David

           

          ///////////////////////////////////////////////////////////////////////////////////////////////////////////

           

           

          if (eventFlag & CX3_DMA_RESET_EVENT)

                      {

                      if (dma_reset_flag == 0)

                      {

          CyU3PDebugPrint(4,"\n\rCB failure");

          curTime = CyU3PGetTime();

          CyU3PDebugPrint(4," @ %d(ms)", curTime);

          //continue;

          }

          else if (dma_reset_flag == 1)

          {

          CyU3PDebugPrint(4,"\n\rVideo timer");

          curTime = CyU3PGetTime();

          CyU3PDebugPrint(4," @ %d(ms)", curTime);

          }

           

          #ifdef PRINT_FRAME_INFO

          TxCount = 0;

          RxCount = 0;

          #endif

          dma_reset_flag = 0;

           

           

                          /* Frame timed out. Abort and start streaming again. */

                          if (glIsApplnActive)

                          {

                          //read cx3 internal csi2 error status register

                          uint32_t errCnts=0;

                          static uint32_t i = 0;

           

           

                         CyU3PMipicsiGetErrors( CyTrue, &errCnts);

                          CyU3PDebugPrint (4,"\n\rCyCx3UvcAppThread_Entry:CyU3PMipicsiGetErrors %d,i=%d", errCnts,i);

                          i++;

                              CyCx3UvcAppStop();

              CyU3PDebugPrint (4,"\n\rCyCx3UvcAppThread_Entry:CX3_DMA_RESET_EVENT UVC will stop and restart");

              CyCx3UvcAppStart();

                          }

                         

          // if glIsApplnActive is not active, we should not restart UVC application

                          // commented out to fix this bug.

                          //CyU3PDebugPrint (4,"\n\rCyCx3UvcAppThread_Entry:CX3_DMA_RESET_EVENT UVC will stop and restart");

          //CyCx3UvcAppStart();

           

           

          #ifdef RESET_TIMER_ENABLE

                          CyU3PTimerStop (&UvcTimer);

                          CyU3PTimerModify (&UvcTimer, TIMER_PERIOD, 0);

          #endif

                      }

          • 2. Re: where is CX3_ERROR_THREAD in UVC demo code?
            decai.wang_2529456

            Dear SIr,

             

            When CB failure occurs again(the second time) ,errCnts = 514,0x0202(hex).

             

            I know the internal mipi block is same as toshiba TC358746, there are several error status registers, what is the relationship betwwen errCnts and these error status registers?