Pages: [1]   Go Down
Author Topic: Disappointing SPI performance with SdFat  (Read 879 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1484
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My Arduino Due finally arrived and I started testing SdFat.

The results are disappointing since the standard SPI library is slow.  I used an SPI clock of 42 MHz.

When I run the SdFat bench example with large 4096 byte reads and writes, the results are just a little slower than the same test on an AVR Mega with an 8 MHz clock.  The Mega is fast since I wrote optimized SPI functions for AVR.  The maximum read/write rates are about 600 KB/sec for a high quality industrial SD.

I checked with a scope on the Due's SCK and the result is that a byte is transferred in about 200 ns then there is a gap of about 1250 ns until the next byte.

The Due SPI library needs optimized block read/write functions.

On Teensy 3.0 I get over three times the performance of Due.  This is with an 24 MHz SPI clock on Teensy 3.0.

The maximum read/write rate is over 2 MB/sec on Teensy 3.0.  Due should be faster with a 42 MHz clock.


« Last Edit: November 24, 2012, 03:31:15 pm by fat16lib » Logged

Offline Offline
God Member
*****
Karma: 21
Posts: 650
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

How does your Maple version compare to the above?
Logged

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

Online Online
God Member
*****
Karma: 32
Posts: 506
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Be assured that it is just the library code that is slow, not the underlying hardware. I've been hitting the hardware directly at 28Mbps and 42Mbps rates and it is running at full speed, no gaps between bytes. Even better, it works with DMA too. smiley-grin (I have only been testing output however, I have not tried input yet.)
« Last Edit: November 24, 2012, 02:01:42 pm by stimmer » Logged


0
Offline Offline
Edison Member
*
Karma: 44
Posts: 1484
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

stimmer,

I understand the problem is with the library.  I want to use the standard SPI library since it's a pain to maintain my own SPI layer for every chip that runs SdFat.  Also, my SPI functions may not play well with the standard SPI library.

I would like to see optimized functions in the SPI library for sending and receiving blocks of data.

Pico,

I don't have a Maple version of SdFat with the new caching improvements for large memory chips.  Others have ported old versions of SdFat to Maple but these are slow.
« Last Edit: November 24, 2012, 03:31:54 pm by fat16lib » Logged

Pages: [1]   Go Up
Jump to: