4 Replies Latest reply on Jul 10, 2020 4:11 AM by YashwantK_46

    CYUSB3014 and PIB clocking

    AlEr_4025481

      Hello!

       

      I'm playing with FX3 SuperSpeed DVK and stuck on PIB clocking. Could someone point me why CyU3PPibInit can't accept clkDiv greater than 32? How can I get for example 100 kHz GPIF peripheral clocking? I can't find in documentation any details except these:

       

      typedef struct CyU3PPibClock_t
      {
          uint16_t clkDiv;            /**< Divider value for the PIB clock. The min value is 2 and max value is 1024. */
          CyBool_t isHalfDiv;         /**< If set to true, adds 0.5 to the frequency divider value selected by clkDiv. */
          CyBool_t isDllEnable;       /**< Whether the DLL should be enabled or not. The DLL in the PIB block should
                                           be enabled when implementing Asynchronous GPIF protocols, or Master mode
                                           GPIF protocols. It should be left turned off when implementing synchronous
                                           slave mode GPIF protocols. */
          CyU3PSysClockSrc_t clkSrc;  /**< The clock source to be used. */
      } CyU3PPibClock_t;
      

       

      The problem part of my code:

      void CyFxApplnInit (void)
      {
          CyU3PReturnStatus_t apiRetStatus = CY_U3P_SUCCESS;
          CyU3PPibClock_t pibClock;
      
      
          /* The problem is below! Program FREEZES after CyU3PPibInit if clkDiv is greater 32, or if clkSrc is CY_U3P_SYS_CLK_BY_XX. */
          pibClock.clkDiv      = 8; // 1024 is valid value but it is not work!
          pibClock.clkSrc      = CY_U3P_SYS_CLK;
          pibClock.isHalfDiv   = CyFalse;
          pibClock.isDllEnable = CyTrue;
      
          /* This runs PIB on 48 MHz (384 MHz SYS_CLK / 8 = 48 MHz), how can I get 100 kHz? */
          apiRetStatus = CyU3PPibInit (CyTrue, &pibClock);
          if (apiRetStatus != CY_U3P_SUCCESS)
          {
              CyU3PDebugPrint (CY_FX_DEBUG_PRIORITY, "P-port Initialization failed, Error Code=%d\r\n", apiRetStatus);
              CyFxAppErrorHandler (apiRetStatus);
          }
      
        • 1. Re: CYUSB3014 and PIB clocking
          YashwantK_46

          Hello,

           

          The clkDiv value can range from a min of 2 to a max of 1024 as mentioned.

           

          " /* The problem is below! Program FREEZES after CyU3PPibInit if clkDiv is greater 32, or if clkSrc is CY_U3P_SYS_CLK_BY_XX. */"

          --> I have tried a clkDiv=40 in gpiftousb example project provided in the SDK and the example is working correctly (no FREEZE observed).

          The path for the firmware: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\firmware\basic_examples\cyfxgpiftousb


          Can you please let me know which firmware you are using?
          Also, please share the UART debug logs so that I can see the error code for the CyU3PPibInit() when clkDiv > 32.

           

          Can you please let me know why isDllEnable set to CyTrue?

           

          Also, can you let me know if you are using SDK 1.3.3 or 1.3.4?

           

          Regards,
          Yashwant

          • 2. Re: CYUSB3014 and PIB clocking
            AlEr_4025481

            Hi Yashwant,

             

            Thanks for your reply! I have checked 'cyfxgpiftousb' example with CyU3PPibClock_t pibClk = {768, CyFalse, CyFalse, CY_U3P_SYS_CLK};

            It works perfectly with 768 and any other values, so I'm really confused why my code does not want to work...

             

            According to c:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\FX3ReleaseNotes.pdf my SDK is 1.3.4, May 8, 2018.

             

            isDllEnable turned to the true because of I plan to use GPIF in master synchronous mode.

             

            When clkDiv is 32 my debug output is a short string: 'Initialization completed.' Blue led is blinking.

             

            Now I changed clkDiv to 128 and there is no any debug messages, blue led is turned off and not blinking.

             

            I tried to comment apiRetStatus = CyU3PPibInit (CyTrue, &pibClock); string and my code works again, I see 'Initialization completed.' and blue led is blinking.

             

            P.S. I'm playing with CYUSB3KIT-003.

             

            • 3. Re: CYUSB3014 and PIB clocking
              AlEr_4025481

              It seems I solved my problem, if isDllEnable = CyFalse my code works fine with any clkDiv values. The explanation below confused me.

               

                  CyBool_t isDllEnable;       /**< Whether the DLL should be enabled or not. The DLL in the PIB block should

                                                   be enabled when implementing Asynchronous GPIF protocols, or Master mode

                                                   GPIF protocols. It should be left turned off when implementing synchronous

                                                   slave mode GPIF protocols. */

              • 4. Re: CYUSB3014 and PIB clocking
                YashwantK_46

                Hello,


                You will also have to use the API CyU3PPibDllConfigure() when the isDllEnable  = CyTrue parameter is used in the CyU3PPibInit() function.

                 

                Please refer to page no. 406, Section 5.28.5.2 of the FX3APIGuide.pdf from the documents folder in the FX3 SDK which gives an explanation about the CyU3PPibDllConfigure() and how it needs to be used.

                The path for the above document: C:\Program Files (x86)\Cypress\EZ-USB FX3 SDK\1.3\doc\firmware

                 

                Regards,
                Yashwant