Why XMOS SDCARD lib is too slow interface.

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

Why XMOS SDCARD lib is too slow interface.

Post by jagspaul »

Hello,
I made SD card interface with Arduino & PIC 4550 with 1 bit SPI interface. I got more than 4mbps speed over SPI. But with XMOS sdcard library I get very low speed, where as XMOS is too fast than arduino Uno & PIC.

I checked source code and found that XMOS sdcard library used bit bang and there is a long delay between each bit change. I think if I remove this delay the SPI speed will be faster.

can any body tell me why this delay has been introduce & what is the purpose of it? Can this code run with out this delay?

Can any body tell me how to use clock block and buffered port in SDCARD library instead of bit bang?

Please guide how to achieve high speed SPI with XMOS?

Thanks & regards
jags


User avatar
Andy
Respected Member
Posts: 279
Joined: Fri Dec 11, 2009 1:34 pm

Post by Andy »

jagspaul wrote:Hello,
I made SD card interface with Arduino & PIC 4550 with 1 bit SPI interface. I got more than 4mbps speed over SPI. But with XMOS sdcard library I get very low speed, where as XMOS is too fast than arduino Uno & PIC.

I checked source code and found that XMOS sdcard library used bit bang and there is a long delay between each bit change. I think if I remove this delay the SPI speed will be faster.

can any body tell me why this delay has been introduce & what is the purpose of it? Can this code run with out this delay?

Can any body tell me how to use clock block and buffered port in SDCARD library instead of bit bang?

Please guide how to achieve high speed SPI with XMOS?

Thanks & regards
jags
Hi jagspaul,

Have you seen the SPI interface on Github?

https://github.com/xcore/sc_spi

There are some performance figures in the documentation:

http://github.xcore.com/sc_spi/overview ... erformance

You should be able to use this to achieve a higher data rate than the implementation in the SD card library. If you do modify the SD card library to use the higher speed SPI, remember to contribute your changes back to Github so other people can use it :)
User avatar
Berni
Respected Member
Posts: 363
Joined: Thu Dec 10, 2009 10:17 pm

Post by Berni »

If you bitbang SPI out without a delay it might be too fast for non high speed cards. One thing to also check is that you are using block read/writes as they are significantly faster than just a single sector operation.
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

Thank you Andy & Berni for your reply.

I will try to implement SIP library to SD card interface. However if anybody already done this please share you knowledge & help me.

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

Post by Lele »

Hi all,
I'm going to release an SD host module which uses 4bit interface in the github.
My preliminary tests give a read speed of 4MBytes/sec (multiblock read, optimization, less than 5 threads).

Lele
Heater
Respected Member
Posts: 296
Joined: Thu Dec 10, 2009 10:33 pm

Post by Heater »

Lele,

Have you considered the licensing requirements of using various SD card features?

I have been trying to find out without much luck but here is a reply someone got from the SD Technical Committee in 2009:

Dear XXXX,
SPI is defined as general protocol.
However, the Physical Layer specification defines
specific bus protocol for SD cards. SD host products
need to refer the Physical Layer specification
regardless of bus mode. Therefore, HALA is required.
Sincerely,
XXXXXX XXXXXXXX
SDA Technical Committee

There is more on that here: http://forums.parallax.com/showthread.p ... -licensing

Is any of this licensing compatible with the MIT license or any other we like to use around here?
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

Hi Lele
I am very much interested to have your SD host module source. Hope it would be better help for me.

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

Post by Lele »

Thanks Heather, you are right,
that might be a problem. I've read your link and look around.
The SD association in their link:
https://www.sdcard.org/developers/howto/
states:
Host and Ancillary Products

If your company is planning to manufacture or have manufactured SD standard devices ...
your company is required to:
...
2.Enter into a Host/Ancillary Product License Agreement (HALA)
I'm not a company and not planning to manufacture hardware :D
That is a problem for those that will use my code.
(Linux has the 4bit protocol sources available for free.
The protocol is the same as MMC.)
However I accept suggestions.

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

Post by Lele »

I've just released the new sc_sdcard library in the github.
jagspaul
Experienced Member
Posts: 117
Joined: Tue Oct 18, 2011 3:28 pm

Post by jagspaul »

Thanks Lele.
Please post the links.

jags