sc_sdcard is now running on XC-3 board

Technical questions regarding the XTC tools and programming with XMOS.
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

Lele,

When I am using fat library (FatFs - FAT file system module R0.09 (C)ChaN, 2011) I am getting test result as following below.
Creating a new file Data.bin...done.

Writing data to the file...20480 bytes written. Write rate: 320KBytes/Sec

Closing the file...done.

Opening an existing file: Data.bin...done.

Reading file content...20480 bytes read. Read rate: 814KBytes/Sec

Closing the file...done.
But when using fat library (FatFs - FAT file system module R0.08b (C)ChaN, 2011) which I am using with my STM32 board I am getting following result.
Creating a new file Data.bin...done.

Writing data to the file...20480 bytes written. Write rate: 530KBytes/Sec

Closing the file...done.

Opening an existing file: Data.bin...done.

Reading file content...20480 bytes read. Read rate: 818KBytes/Sec

Closing the file...done.
See in both cases reading speed is same but high writing speed is achieved with R0.08b fat module (530KBytes/Sec).

Please comment on this issue.

What speed you are getting???

regards
jags


User avatar
Lele
Active Member
Posts: 52
Joined: Mon Oct 31, 2011 4:08 pm

Post by Lele »

Have some speed reports here:
http://www.xcore.com/forum/viewtopic.p ... &start=10
mainly it depends upon compiler optimization and formatting allocation unit size.
GerhardNorkus
Active Member
Posts: 55
Joined: Wed Jan 05, 2011 2:15 pm

Post by GerhardNorkus »

Has anyone had the same problems I'm having?

D0 just will not read correctly. I've tried running this on an XC-1A, as seen in the attached picture. No cable, just jumper wires all over the place. The card reads fine on windows machine, but the D0, D1 lines never output any data. It just times out in initialization. Anyone got this to work on XK-1, either?

Attached are some trace dumps, which by the way, I used the XC-1A to obtain these dumps. I've attached the trace code for that too. I use an Windows MFC application to parse through the raw trace data and generate the neater output.
You do not have the required permissions to view the files attached to this post.
GerhardNorkus
Active Member
Posts: 55
Joined: Wed Jan 05, 2011 2:15 pm

Post by GerhardNorkus »

By the way, the pull-up's are 100k per SDCard org specs. I also have a picture of the XK1 setup I'm using. 10k ohm resistors were soldered to back, but I find the XK-1 is flaaaaky. Sometimes it comes up, sometimes it doesn't.

I modified the port connections as follows in the SDCardHost4Bit.xc:
{XS1_PORT_1E, XS1_PORT_1F, XS1_PORT_4D, 0, 0, 0}; // ports used for interface #0 for XK1

And here is a trace that I get from it:
Entering chk_mounted
Entering SendCmd Cmd=0 Arg=0x00000000
Entering SendCmd Cmd=8 Arg=0x000001AA[08][00][00][01][AA][13]
Entering SendCmd Cmd=55 Arg=0x00000000 [37][00][00][01][20][83]
Entering SendCmd Cmd=41 Arg=0x513C0000 [3F][FF][FF][FF][FF][FF]
Entering SendCmd Cmd=2 Arg=0 timeout 1 in SendCmd
Check mounted drives res=3

Failed with rc=3.
Jerry was here
You do not have the required permissions to view the files attached to this post.
GerhardNorkus
Active Member
Posts: 55
Joined: Wed Jan 05, 2011 2:15 pm

Post by GerhardNorkus »

Sheepish grin...

Turns out I had my wiring wrong on the XK1. I've gotten it to go farther now that I don't have D0 hooked to ground, and VCC hooked to Port4E.3! A few more nigglies, and I might have the XK1 working....

Still having problems with the XC-1A. Perhaps I fried it a long time ago and didn't know I did so. Doesn't explain why I was able to trace on it...
GerhardNorkus
Active Member
Posts: 55
Joined: Wed Jan 05, 2011 2:15 pm

Post by GerhardNorkus »

More progress...

Needed to remove a line from the 1-bit reading code I had inserted into the SDCardHost4Bit.xc in the SendCmd function. In my copying of the code, I had inadvertently tried to stuff the 1 bit response into a NULL buffer pointer. The offending line

buff[DatByteCount++] = bitrev(Dat);

Was removed from the DAT_RECEIVING_BITS case I had added. Now I have gotten to where someone else has previously been, namely the following:

Leaving check_fs failed with record signature mismatch
Check mounted drives res=13
Failed with rc=13.

So...just a little further...

If I make good progress with the XK-1 board, I should be able to do the high speed transfers at 50MHz, and will see how a UHS-1 card responds to that.... I will post any code that I am able to generate that will allow the high speed transfers...I do assembly language...
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

GerhardNorkus

Take dump of sector 0 (get my code from this post) and post the result. I need to see, then only I can make any comment.


jags
Last edited by jagspaul on Wed Aug 08, 2012 11:54 am, edited 1 time in total.
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

lele,

I used your code (raw sector read write from speed related post) and get result as follows.
20480 bytes written. Write rate: 699KBytes/Sec
20480 bytes read. Read rate: 951KBytes/Sec
I am using 2 GB &n 8GB micro SD, make Transcend. I run the code in release mode (i.e. optimization -O3)

Your test result is very much surprising.
Lele's Test result:FAT32 with 64K allocation unit.
Writing data to the file...20480 bytes written. Write rate: 1428KBytes/Sec
Reading file content...20480 bytes read. Read rate: 3625KBytes/Sec

FAT32 with 4K allocation unit.
Writing data to the file...20480 bytes written. Write rate: 758KBytes/Sec
Reading file content...20480 bytes read. Read rate: 2679KBytes/Sec
Only thinks is deffer that your test card is SDHC 4GB class4 (by Emtec).

Can you give me a test result with MICRO SD card, as because in our market this card is readily available and chiper one.

regards
jags
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

Lele,

My 2 GB micro SD card is not making any issue regarding low speed read write.
Actually I have test the same card in my PC (win-xp) and got 8.6 MBytes/sec read & 3.5 MBytes/sec write speed.

I think the issue is related with XMOS side.

Regards
jags
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

It is found that in sc_sdcard SPI interface used buffered port. I think It will be quite fast. Can anybody test this library with SPI interface and share the read write speed in this forum. I would like to compare it with 4bit interface.

@lele
You have done a good job of 4bit interface. but you have not buffered port. That may be a reason of low speed while using 4 bit interface. If you are interested I can Collaborate with you to make it high speed as much as XMOS can.

Also I requests other people who are interested to come forward and make sc_sdcard library more efficient.

Thanks & regards
jags