0
Offline
Edison Member
Karma: 28
Posts: 1079
Arduino rocks
|
 |
« on: December 03, 2012, 01:30:04 pm » |
I posted a version of SdFat with support for Due as SdFatBeta20121203.zip http://code.google.com/p/beta-lib/downloads/list. Please read these files before using this version: ArduinoDue.txt changes.txt readme.txt There are a huge number of internal changes to improve support for Due, Teensy 3.0, and Mega so expect bugs. Try the bench.ino example with a large buffer size. Here are results for this low cost class 4 card http://www.newegg.com/Product/Product.aspx?Item=N82E16820171480. I used a 32,768 byte buffer with a 20 MB file. Free RAM: 62747 Type is FAT32 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 4159.07 KB/sec Maximum latency: 21412 usec, Minimum Latency: 7651 usec, Avg Latency: 7867 usec
Starting read test. Please wait up to a minute Read 4390.18 KB/sec Maximum latency: 12419 usec, Minimum Latency: 7415 usec, Avg Latency: 7462
Here are the changed defines for bench.ino #define FILE_SIZE_MB 20 #define FILE_SIZE (1000000UL*FILE_SIZE_MB) #define BUF_SIZE 32768
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 83
Arduino rocks
|
 |
« Reply #1 on: December 03, 2012, 06:03:17 pm » |
Thank you! I'll test that! 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 23
Posts: 446
|
 |
« Reply #2 on: December 03, 2012, 06:24:08 pm » |
Looking good - I've ran bench with the changed defines and no other changes on the cards I had. Two of them were with odd partitions initially.(they were bootdisks for a raspberry pi) I ran each test twice. [MicroSDHC 4G class 2 in adapter, 56MB partition]
Type any character to start Free RAM: 62747 Type is FAT16 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 866.16 KB/sec Maximum latency: 183747 usec, Minimum Latency: 31926 usec, Avg Latency: 37813 usec
Starting read test. Please wait up to a minute Read 2547.93 KB/sec Maximum latency: 13355 usec, Minimum Latency: 12608 usec, Avg Latency: 12860 usec
Done
Type any character to start Free RAM: 62747 Type is FAT16 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 861.76 KB/sec Maximum latency: 173563 usec, Minimum Latency: 32131 usec, Avg Latency: 38007 usec
Starting read test. Please wait up to a minute Read 2550.53 KB/sec Maximum latency: 13337 usec, Minimum Latency: 12609 usec, Avg Latency: 12846 usec
Done
[MicroSDHC 16GB Ultra Class 1 in adapter, 56MB partition]
Type any character to start Free RAM: 62747 Type is FAT16 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 2971.38 KB/sec Maximum latency: 77963 usec, Minimum Latency: 9330 usec, Avg Latency: 11020 usec
Starting read test. Please wait up to a minute Read 3931.64 KB/sec Maximum latency: 9612 usec, Minimum Latency: 8294 usec, Avg Latency: 8331 usec
Done
Type any character to start Free RAM: 62747 Type is FAT16 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 2832.83 KB/sec Maximum latency: 212444 usec, Minimum Latency: 9343 usec, Avg Latency: 11560 usec
Starting read test. Please wait up to a minute Read 3931.64 KB/sec Maximum latency: 9606 usec, Minimum Latency: 8293 usec, Avg Latency: 8333 usec
Done
[Standard SD card, 1GB class 2, partitioned normally, but only 30Mb free space]
Type any character to start Free RAM: 62747 Type is FAT16 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 3157.74 KB/sec Maximum latency: 202461 usec, Minimum Latency: 8545 usec, Avg Latency: 10354 usec
Starting read test. Please wait up to a minute Read 4111.16 KB/sec Maximum latency: 9299 usec, Minimum Latency: 7892 usec, Avg Latency: 7969 usec
Done
Type any character to start Free RAM: 62747 Type is FAT16 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 3041.00 KB/sec Maximum latency: 238158 usec, Minimum Latency: 8458 usec, Avg Latency: 10751 usec
Starting read test. Please wait up to a minute Read 4112.86 KB/sec Maximum latency: 8409 usec, Minimum Latency: 7897 usec, Avg Latency: 7964 usec
Done
[same MicroSDHC 4G class 2 in adapter as first test, but freshly formatted as one big FAT32 partition]
Type any character to start Free RAM: 62747 Type is FAT32 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 1408.04 KB/sec Maximum latency: 154868 usec, Minimum Latency: 19368 usec, Avg Latency: 23058 usec
Starting read test. Please wait up to a minute Read 3303.33 KB/sec Maximum latency: 10479 usec, Minimum Latency: 9780 usec, Avg Latency: 9917 usec
Done
Type any character to start Free RAM: 62747 Type is FAT32 File size 20MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 1419.64 KB/sec Maximum latency: 153552 usec, Minimum Latency: 19564 usec, Avg Latency: 22867 usec
Starting read test. Please wait up to a minute Read 3304.97 KB/sec Maximum latency: 10541 usec, Minimum Latency: 9837 usec, Avg Latency: 9912 usec
Done
Incidentally I am using 6 inch flying leads from the SPI port into a breadboard and an SD breakout. No errors 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #3 on: December 04, 2012, 12:39:17 am » |
init failed for me using the sparkfun sd shield. The same sketch with the same shield worked fine with the UNO. Set SdChipSelect correctly and Tried SPI_HALF_SPEED and the other ones, but no luck. Not sure what I'm doing wrong.
|
|
|
|
|
Logged
|
|
|
|
|
Dubai, UAE
Offline
Edison Member
Karma: 20
Posts: 1627
|
 |
« Reply #4 on: December 04, 2012, 01:29:24 am » |
Hi, I tried a sheild a few days ago, It will not work as the SPI pins on the due are not connected through the normal digital pins as they are on UNO and MEGA, they are instead broken out through a six pin male head in the center of the board - see the pinout. I made a little adaptor to connect my sheild to this, for me this also did not work - I am guessing that it was down to the level shift IC on the breakout board which is designed to shift down from 5V to 3.3V, the due is already at 3.3 volt. The last thing I tried, was to solder jumpers directly to the SD Card and connect these to the SPI pins of the Due, this worked very well - it also means I can't easily connect my SD Card back to a PC, but that may or may not be a problem for you - it is not a problem in my application - as an alternative, you might be able to by pass the level shift IC on your breakout board. The pin out of the SD Card is in a link in the http://elasticsheep.com/2010/01/reading-an-sd-card-with-an-atmega168/Duane B
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1079
Arduino rocks
|
 |
« Reply #5 on: December 04, 2012, 07:51:37 am » |
king44444, The SparkFun shield does not connect to the correct pins. The SparkFun shield uses the ATmega168/328's standard SPI pins (digital 11-13), not the ICSP header. See http://arduino.cc/en/Main/ArduinoBoardDue. Here is the key part: SPI: SPI header (ICSP header on other Arduino boards) These pins support SPI communication using the SPI library. The SPI pins are broken out on the central 6-pin header, which is physically compatible with the Uno, Leonardo and Mega2560. The SPI header can be used only to communicate with other SPI devices, not for programming the SAM3X with the In-Circuit-Serial-Programming technique.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 83
Arduino rocks
|
 |
« Reply #6 on: December 07, 2012, 08:59:43 pm » |
Hi.
I can't initialize faster then SPI_DIV6_SPEED, but even with only this speed, I get double the speed in slideshow that I had previously. My tft is ITDB32WD (400x240), and I load a full image in 0.37s. Without DMAC, it tooks 0.70s.
Thank you very much!!!
But about speed, how do you have it wired to be able to handle 42Mhz?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1079
Arduino rocks
|
 |
« Reply #7 on: December 07, 2012, 09:20:46 pm » |
I have an SD socket connected directly to the SPI header with very short, under an inch, wires on a proto shield. stimmer has this setup. Incidentally I am using 6 inch flying leads from the SPI port into a breadboard and an SD breakout. No errors
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 83
Arduino rocks
|
 |
« Reply #8 on: December 08, 2012, 07:35:12 am » |
Ok, thank you.
I've one SD module somewhere, I'll wire it up to test it.
BR,
Joao
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 83
Arduino rocks
|
 |
« Reply #9 on: December 08, 2012, 01:39:46 pm » |
Well, confirmed. Wired directly to ICSP header on due I get full speed!!  I getting from a Sandisk Extreme PRO (95MB/s): Type any character to start Free RAM: 62747 Type is FAT32 File size 50MB Buffer size 32768 bytes Starting write test. Please wait up to a minute Write 4235.57 KB/sec Maximum latency: 30782 usec, Minimum Latency: 7633 usec, Avg Latency: 7732 usec
Starting read test. Please wait up to a minute Read 4436.36 KB/sec Maximum latency: 7791 usec, Minimum Latency: 7373 usec, Avg Latency: 7385 usec
Done
The best speed is obtained with 32k buffer. I'm running slideshow now in 295mSec per picture, outstanding!!!  Would it be to hard to implement the paralell mode in arduino? I don't mind to sacrifice the card reader to have it working this way!!! 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1079
Arduino rocks
|
 |
« Reply #10 on: December 08, 2012, 05:03:13 pm » |
I don't think the SDIO 4-bit mode can be implemented on Due. It appears that I/O line PA21 is used to drive the TX LED. The High Speed MultiMedia Card Interface uses PA21 for MCDA0, data line 0 of the SD. I plan to play with 4-bit SDIO mode sometime in the future for SdFat. There are drivers for STM32F4 and I have an Olimex STM32-H407 so that may be first. This is an amazing card for about $39 https://www.olimex.com/Products/ARM/ST/STM32-H407/. 168 MHz, 1 MB Flash, 196 KB RAM
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 83
Arduino rocks
|
 |
« Reply #11 on: December 08, 2012, 08:55:10 pm » |
I agree, the specs are amazing!  Ok, I just thought abut the 4 bit interface because it could be simpler and faster to implement. I'll google on that to see what I get. Thank you! 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Edison Member
Karma: 28
Posts: 1079
Arduino rocks
|
 |
« Reply #12 on: December 08, 2012, 09:32:01 pm » |
The 4-bit SDIO interface is usually not simpler to use than SPI.
The protocol is propitiatory and only practical using the built in SDIO controller. With Due it appears you can't use the SDIO controller since one I/O line from the SDIO controller is used for the TX LED.
Using SDIO requires writing a new SD card layer since it is very different than the SD SPI protocol.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Jr. Member
Karma: 1
Posts: 83
Arduino rocks
|
 |
« Reply #13 on: December 09, 2012, 05:44:36 am » |
Humm, ok, that's bad news. We have to stick with SPI then, ok.
Thank you for the info.
|
|
|
|
|
Logged
|
|
|
|
|
|
|
|