4 Replies Latest reply on Aug 16, 2019 3:05 AM by HuYa_4249091

    FX3 - How to use CyU3PGpifRegisterSMIntrCallback

    HuYa_4249091

      Hi All,

       

      I use the FX3 to receive the data of camera chip to PC by USB3.0, so I refer the UVC - AN75779 document & example to design the mechanism.

      I can use the CyU3PGpifRegisterCallback() to trigger a callback from State Machine - "INTR_CPU", and it's work to receive the data and show on PC.

      However, if I replace the CyU3PGpifRegisterCallback() to CyU3PGpifRegisterSMIntrCallback(), it's not work anymore...

      The callback will never be triggered, and it causes that the PC cannot receive any data.

       

      Register code:

      main code.jpg

       

      Callback code:

      callback code.jpg

       

      In the API document, it mentions "Please note that API calls that require a mutex get or equivalent cannot be directly called from this callback function.", but I don't know the meaning, and don't find any mutex for that in the AN75779 example.

       

      Do I miss something? Hope anybody could provide me some suggestion!

       

      Thanks a lot!

      Hughes

       

      [Environment]

      Chip: CYUSB3014

      SDK version: v1.33

      DMA mode: auto DMA

        • 1. Re: FX3 - How to use CyU3PGpifRegisterSMIntrCallback
          RashiV_61

          Hello,

           

          As you said, the API document mentions "Please note that API calls that require a mutex get or equivalent cannot be directly called from this callback function." This means that an API, in which "mutex get" (function) is used, cannot be called directly in the Callback function.

           

          In your case, the callback function uses CyU3PDmaMultiChannelSetWrapUp & CyU3PDebugPrint() APIs and both of them call  "mutex get" function in their implementation. This means you can not use CyU3PDmaMultiChannelSetWrapUp & CyU3PDebugPrint() API call  in call back function if you are using CyU3PGpifRegisterSMIntrCallback().

           

          Regards,

          Rashi

          • 2. Re: FX3 - How to use CyU3PGpifRegisterSMIntrCallback
            HuYa_4249091

            Dear RashiV_61:

             

            Thanks for your reply!

            I referred the AN75779 example which use the CyU3PDmaSocketSetWrapUp() rather than CyU3PDmaMultiChannelSetWrapUp() inside the CyU3PGpifRegisterSMIntrCallback.

            UVC function.jpg

            It works! Thank you!

             

            Now, I want to clarify 2 things:

            1.it means that the CyU3PDmaSocketSetWrapUp() is NOT a "mutex get" function, so it's valid inside the CyU3PGpifRegisterSMIntrCallback?

            2.I cannot find any document to indicate the CyU3PDmaMultiChannelSetWrapUp() & CyU3PDebugPrint() is a "mutex get" function. How to recognize whether a function is a "mutex get" or not?

             

            Thanks a lot!

            Hughes

            • 3. Re: FX3 - How to use CyU3PGpifRegisterSMIntrCallback
              RashiV_61

              Hi Hughes,

               

              1) Yes, CyU3PDmaSocketSetWrapUp() does not use mutexget() function in it's implementation and can be used with CyU3PGpifRegisterSMIntrCallback.

               

              2) To know an API's implementation, you can refer to the source files in the SDK

              Path: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\fx3_sdk_1_3_4_src\fx3_sdk_1_3_4_src\FX3

               

              Regards,

              Rashi

              • 4. Re: FX3 - How to use CyU3PGpifRegisterSMIntrCallback
                HuYa_4249091

                Dear RashiV_61:

                 

                Thanks for reply!

                I referred the "FX3APIGuide.pdf" and found the return value of CyU3PDmaMultiChannelSetWrapUp() with the mutex description, so I guess I could use it as a judgement.

                mutex function.jpg

                 

                Thanks for your specialized reply!

                Hughes