FX3S FX3SMassStorage Sample question

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

cross mob
lock attach
Attachments are accessible only for community members.
pase_853586
Level 2
Level 2

Hello.

I have one problem in my device based on FX3S IC.

I got the same problemm in the FX3SMassStorage Sample with minimal changes.

The problem is next:

In function CyFxMscApplnSibInit after successfuly calling of function CyU3PSibStart I try to call the function CyU3PSibInitCard for port 0 in a loop. And I have only 3 success result. And after this all attempts is unsuccessfull.

The log  next:

Found a device on port 0

        Type=1, numBlks=7634944, eraseSize=524288, clkRate=96000000

        blkLen=512 removable=1, writeable=1, locked=0

        ddrMode=1, opVoltage=0, busWidth=1, numUnits=4

        cardCmdClass=245

Dev 0, Unit 0: location=1 numBlocks=8192

Dev 0, Unit 1: location=2 numBlocks=8192

Dev 0, Unit 2: location=0 numBlocks=3817472

Dev 0: Found user partition

Dev 0, Unit 3: location=0 numBlocks=3817408

Dev 0: Found user partition

Port 0: Skipping boot partition 0

Port 0: Skipping boot partition 1

Dev 0, Unit 2: blkSize=512 numBlocks=3817472

Dev 0, Unit 3: blkSize=512 numBlocks=3817408

Device Type(0): OK!

Device Type(1): OK!

Device Type(2): OK!

Device Type(3): FAIL!

Device Type(4): FAIL!

Device Type(5): FAIL!

Device Type(6): FAIL!

Device Type(7): FAIL!

Device Type(8): FAIL!

Device Type(9): FAIL!

Calling USB Connect

But! If I change parameter "intfParams.useDdr" from "CyTrue" to "CyFalse" the problemm totaly gone!

And I will get the next log:

...

Device Type(0): OK!

Device Type(1): OK!

Device Type(2): OK!

Device Type(3): OK!

Device Type(4): OK!

Device Type(5): OK!

Device Type(6): OK!

Device Type(7): OK!

Device Type(8): OK!

Device Type(9): OK!

...

In the attached file the project with the problem.

Its a copy of FX3SMassStorage Sample.

But in file cyfx3s_msc.c I chenged function CyFxMscApplnSibInit to demonstarate the problem.

You can bild the project and to get the problemm.

It's no need driver or anymore because the problem can be seen in Initialisation Function of device.

Please help me to solve this problem. It's very important. Thank's.

0 Likes
1 Solution

Hi,

After analyzing the SDIO commands please share the sequence of commands in both passing and failing cases. Try to check the code flow with those commands in cyu3cardmgr_fx3.c file.

Thanks & Regards
Abhinav Garg

View solution in original post

0 Likes
17 Replies
pase_853586
Level 2
Level 2

The problem is still active now. Maybe need I call some other function before repeat calling the function CyU3PSibInitCard? But I tried some of functions and the problem stay. Only 4 successs execution with "DDR=CyTrue" option.

0 Likes

Hi Pavel,

I tried to reproduce the issue with the firmware that you have attached but it is working fine. I am able to get 4 drives. Which SDK version are you using?

Thanks & Regards

Abhinav

0 Likes

My SD version is 1.3.3.

But problem not in drive count as you write

Problem is in multyple call of CyU3PSibInitCard function.

My real task is card reader device. I need have possibility to change the drives in SD slot and work with new one. But after four card CyU3PSibInitCard returns me FAIL.

The same problem I can see in FX3SMassStorage Sample on my device. If I build the project from attach file and load it to RAM over ControlCenter software I can see in terminal log only 4 success result.

But if I chahge option DDR = to CyFalse I can see 10 success result of calling CyU3PSibInitCard funtion.

0 Likes

Hi,

I assume that you are also able to enumerate the drives using the above firmware, you are facing issue in calling "CyU3PSibInitCard" API multiple times. Could you please explain the scenario in which you need it? And also please try to probe the lines between FX3S and SD card to check the status of card when this issue occurs.

Thanks & Regards
Abhinav Garg

0 Likes

My device do power on and enumerate process by software command. By default the power of SD socket is off.

Device have two card socket. Every socket is independept from each other and have it own power switch.

My scenario is:

1) Init device. At this momet I call CyU3PSibStart but no cards insert yet and no power on the socket.

2) Insert the first SD card into socket.

3) Power on the SD card.

4) Call of CyU3PSibInitCard function

5) Work with this card. Read/write.

6) Power off the SD card.

7) Insert the second SD card into socket.

😎 Power on the SD card.

9) Call of CyU3PSibInitCard function

10) Work with this card. Read/write.

11) Power off the SD card.

.....

After 4 SD card I have the problem above.

Line state between FX3S and SD card I'll check now and write you throught some time.

0 Likes

I probed lines between FX3S and SD card. There is no difference in state at first card and other. All lines in '1' state (3.3V). Clk have some frequency about 400 kHz.

0 Likes

I'm sorry. I didn't say about one important moment. I work not with simple SD or micro SD card but with eMMC chip which  is insert into MMC4.1-SD adapter.

(like this https://ru.aliexpress.com/item/eMMC-test-adapter-with-SD-Interface-Open-Top-Structure-for-BGA153-Chi...)

And this adapter I insert into the SD COMBO socket. Another words I work with eMMC chip in DDR 100 MHz mode on 8 bit bus.

As I check now with simple SD card there is not problem!

0 Likes

Detailing of problem: the problem is on 8 bit eMMC chip in DDR mode. Simple SD card have not this problem. But I need to work exactly with 8 bit eMMC card.

0 Likes

Two addition, may be it help to understand the situation.

1) If in attached file I change parameter of intfParams.maxFreq from 104 Mhz to 52 Mhz the problemm seems gone and in Ddr=CyTrue and in Ddr=CyFalse mode. 

2) If in attached file in the test loop between calling CyU3PSibInitCard I insert the next code:

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);

the problemm seem gone too.

It's no solutions for me but my test results.

0 Likes
lock attach
Attachments are accessible only for community members.

Hi Pavel,

As suggested by you I tried with the emmc chip inserted in the emmc SD adapter. I tried with two different chips, one is Samsung

KLM8G2EEHM-B101, this works fine without fail (see the attached debug logs) and the other one is Micron 41A18 JWA07 EMMC flash, with this chip I am able to reproduce the issue (see the attached logs). So, could you please try with other EMMC chip at your end?

Thanks & Regards
Abhinav

0 Likes

Hi Abhinav.

It is good that you are able to reproduce the issue. May be it will help to explain it.

Today I made the test on my side as you asked me.

Unfortunately I have no Micron eMMC chip but I am getting the same  problemm on the next chips:

Samsung KMFJ20005A-B213 (eMMC 221 11,5x13 ) (2 chips)

Samsung KLMCG8GEND-B031 (eMMC 169x153 11,5x13) (2 chips)

SK Hynix HQTP32A8JDBC (eMCP 186x162 11,5x13 ) (1 chip)

SanDisk SDIN5C4-64G (eMMC 169x153 12x16) (3 chips)

All this chips have the problem in DDR mode.

0 Likes

I am sorry for disturb you do you have any news? If you can reproduce the issue how you explain what is the reason? Why we have only four successful initialisation? What is the reason of fail fifth one? May be DMA channel is not working? Or memory card did not ansver on the request? Or some of the ports are locked? Becouse you are can go inside the function CyU3PSibInitCard under debugging but I can't.

0 Likes

Hi Pavel,

According to TRM "The S-block supports clock frequencies ranging from 400-kHz to 104-MHz SDR (or 52-MHz DDR)". That is why your problem is gone when you change parameter of intfParams.maxFreq from 104 Mhz to 52 Mhz. Also the problem is gone when you use SDR mode instead of DDR mode. For more info please refer FX3 TRM section 9 (page 207).

Thanks & Regards

Abhinav

0 Likes

Thank you for answer, but if I change intfParams.maxFreq from 104 Mhz to 52 Mhz the DDR mode will not activate. As I can see by source code of function CYU3PCardMgrMMCInit in file cyu3pcardmgr_fx3.c (FX3_SDK_1.3.3) DDR mode will be activte only if intfParams.maxFreq is 104 Mhz.

My tests are confirm this. If I change intfParams.maxFreq from 104 Mhz to 52 Mhz the DDR mode did not on for all my MMC card. Only 52 Mhz, SDR.

As I understand that means if I canhge intfParams.maxFreq from 104 Mhz to 52 Mhz the result will be not only disable DDR mode for all card but limiting SDR mode frequncy for SDR mode card.

Actually as i can see even with intfParams.maxFreq=104 Mhz and DDR="ON" FX3S controller works good but only four times. Why is only four times? May be if you say me the reason I try to fix it on my side.

Sorry for disturb you so long but the question is very important for me.

0 Likes

Hi,

If you have a logic analyzer then try to probe the SDIO lines and check the CMD's going out of FX3S and responses in passing as well as failing cases. Kindly update it on the thread.

Thanks & Regards
Abhinav Garg

0 Likes

Hi,

After analyzing the SDIO commands please share the sequence of commands in both passing and failing cases. Try to check the code flow with those commands in cyu3cardmgr_fx3.c file.

Thanks & Regards
Abhinav Garg

0 Likes

Unfortunately I haven't the logical analyzer but I can try to research the problem with oscilloscope. It may take some time.

0 Likes