FX3S CyU3PSibReInitCard Problem

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
pase_853586
Level 2
Level 2

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?

0 Likes
1 Solution
abhinavg_21
Moderator
Moderator
Moderator
50 likes received 25 likes received 10 likes received

Hi Pavel,

Can you please tell me which SDK example you had used to test this loop? In the second work around you are configuring "ddrMode" as CyFalse, Can you please confirm what happens if you keep this parameter as CyTrue?

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;

Thanks & Regards

Abhinav

View solution in original post

0 Likes
6 Replies
abhinavg_21
Moderator
Moderator
Moderator
50 likes received 25 likes received 10 likes received

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

0 Likes

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?

0 Likes

Hi Pavel,

I tried testing with RAID firmware library, it worked fine. You can test it and update the results. Here is the link for the AN89661 which uses this library. "api" folder contains the library binaries for FX3S. I will try with the default library and update if issue is reproduced.

http://www.cypress.com/documentation/application-notes/an89661-usb-raid-1-disk-design-using-ez-usbr-...

Thanks & RegardsAbhinav

0 Likes

Hi Pavel,

I had never seen such frequent re-initialization of card in any application. Could you please tell me the use case for this? Is it meant for testing only or are you building any application.

Thanks & Regards

Abhinav

0 Likes

Hi, adga. Yes, it's a real task for my application. I'm agree it's a rather specific. The problem is not solved yet. I'll plan to get the problem with one of sample SDK code and after this I'll write you again.

0 Likes
abhinavg_21
Moderator
Moderator
Moderator
50 likes received 25 likes received 10 likes received

Hi Pavel,

Can you please tell me which SDK example you had used to test this loop? In the second work around you are configuring "ddrMode" as CyFalse, Can you please confirm what happens if you keep this parameter as CyTrue?

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;

Thanks & Regards

Abhinav

0 Likes