2 Replies Latest reply on Aug 17, 2018 8:21 AM by user_73631406

    FX3S CyU3PSibReInitCard Problem

    user_73631406

      Hello.

       

       

      I use FX3S and try to work with MMC card connected to S0 port. In my test function I wrote the next loop

       

       

      for(i=0;i<10;i++)

      {

           status=CyU3PSibReInitCard(0);

       

       

           if(status != CY_U3P_SUCCESS)

           {

                break;      

           };

      };

       

       

      As I can see that the loop execute only 4 times. And after 5 loop it function return error code 0x68.

      But, If I change "useDdr" field in the structs CyU3PSibIntfParams_t for function CyU3PSibSetIntfParams and set this field=CyFalse i have no more  problems. The test loop execute 10 time correctly.

       

       

      The MMC card wich I use is supporting DDR.

       

       

      How I can solve this problem?

        • 1. Re: FX3S CyU3PSibReInitCard Problem
          abga

          Hi,

           

          Please put a delay function before "status=CyU3PSibReInitCard(0);" and then check.

          Tell me whether you are using custom board or any development kit. Also mention which FX3SDK version you are using to build this code.

           

          Thanks & Regards

          Abhinav

          • 2. Re: FX3S CyU3PSibReInitCard Problem
            user_73631406

            Thanks for your answer.

             

             

            I use FX3_SDK_1.3.3.

             

             

            First of all I must excuse. My really test function is next:

             

             

            for(i=0;i<10;i++)

            {

                 status1=CyU3PSibReInitCard(0);

             

                 if(status1 != CY_U3P_SUCCESS)

                 {

                      break;    

                 };

             

                status2=CyU3PSibQueryDevice(0,"my struct");

                 if(status2 != CY_U3P_SUCCESS)

                 {

                      break;    

                 };

            };

             

             

            And Error Code = 0x68 is returned by CyU3PSibQueryDevice function after four step . The reason is the field cardType of struct glCardCtxt[0] after four steps become 0 (NO_DEVICE). But on the first four steps is equal 1 (MMC_DEVICE).

            If I out test string on every loop I can see the next:

             

            "

            i=0 status1= 0 status2=0       glCardCtxt[0].cardType=1

            i=1 status1= 0 status2=0       glCardCtxt[0].cardType=1

            i=2 status1= 0 status2=0       glCardCtxt[0].cardType=1

            i=3 status1= 0 status2=0       glCardCtxt[0].cardType=1

            i=4 status1= 0 status2=0x68 glCardCtxt[0].cardType=0

            i=5 status1= 0 status2=0x68 glCardCtxt[0].cardType=0

            i=6 status1= 0 status2=0x68 glCardCtxt[0].cardType=0

            i=7 status1= 0 status2=0x68 glCardCtxt[0].cardType=0

            ....

            "

             

            But, If I change "useDdr" field in the structs CyU3PSibIntfParams_t for function CyU3PSibSetIntfParams and set this field=CyFalse i have no more  problems. The test loop execute 10 time correctly.

             

            The other one solution as I can find is use the next code after CyU3PSibReInitCard in the loop.

             

            "

            while ((SIB->sdmmc[0].status & CY_U3P_SIB_DAT0_STAT) == 0);

            SIB->sdmmc[0].cs |= (CY_U3P_SIB_SDMMC_CLK_DIS);

             

            SIB->sdmmc[0].mode_cfg = CY_U3P_SIB_SDMMC_MODE_CFG_DEFAULT;

             

            SIB->sdmmc[0].cs &= (~CY_U3P_SIB_SDMMC_CLK_DIS);

            glCardCtxt[0].ddrMode = CyFalse;

            "

             

            I mean If I correct the test function as I sample below the problem will gone even if I will set field "useDdr" in CyTrue state.

             

            for(i=0;i<10;i++)

            {

                 status1=CyU3PSibReInitCard(0);

             

                 if(status1 != CY_U3P_SUCCESS)

                 {

                      break;    

                 };

             

             

                status2=CyU3PSibQueryDevice(0,"my struct");

                 if(status2 != CY_U3P_SUCCESS)

                 {

                      break;    

                 };

             

                 while ((SIB->sdmmc[0].status & CY_U3P_SIB_DAT0_STAT) == 0);

                 SIB->sdmmc[0].cs |= (CY_U3P_SIB_SDMMC_CLK_DIS);

             

                 SIB->sdmmc[0].mode_cfg = CY_U3P_SIB_SDMMC_MODE_CFG_DEFAULT;

             

                 SIB->sdmmc[0].cs &= (~CY_U3P_SIB_SDMMC_CLK_DIS);

                 glCardCtxt[0].ddrMode = CyFalse;

            };

             

             

            About delay: yes, I did try to set delay 1 second before every call of CyU3PSibReInitCard. This have no effects.

             

            Can you explain why this problem may be?