jimkmc / beta-lib

Automatically exported from code.google.com/p/beta-lib
0 stars 0 forks source link

Ardunio Due Requires 1/16 Clock Speed #11

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Test setup:

Software:
Ardunio 1.5.4, Windows XP
SdFatBeta20130621

Hardware:
Arduino Due
DFRobot SDCard board with very short leads, soldered to 6 pin SPI connector. SS 
= pin 10 (see image)
Samsung 4GB SDHC card or Kingston 8GB SDHC card

With this setup, it is necessary to select SPI_SIXTEENTH_SPEED during init, or 
else this error code is displayed:

SD errorCode: 0X4,0XFF

When SPI_SIXTEENTH_SPEED is selected, the test setup works normally.

The signal waveforms have been carefully examined using an oscilloscope, and 
there do not appear to be any signal integrity problems (overshoot, ringing, 
etc). Also, the Due uses 3.3V signaling, as does the SD card. The 3.3V 
regulator output on the DFRobot adapter looks clean.

The following compile time options were tried, all with no effect

USE_NATIVE_SAM3X_SPI 0
USE_SAM3X_BUS_MATRIX_FIX 1

A guess is that there is another timing spec not being met? Inter-byte timing, 
for example?

Original issue reported on code.google.com by ry...@rymar.com on 28 Oct 2013 at 7:41

Attachments:

GoogleCodeExporter commented 9 years ago
If I could spell, I would have typed "Arduino"...

Original comment by ry...@rymar.com on 28 Oct 2013 at 7:44

GoogleCodeExporter commented 9 years ago
You need to use an SD socket with no resistors, caps, or regulator.

I test with a simple SD socket connected directly to 3.3V and the SPI signals 
on the six pin ISP connector.  It runs at full speed.

Original comment by Bill.Gre...@gmail.com on 28 Oct 2013 at 8:35

GoogleCodeExporter commented 9 years ago
The resistors shown are 47 ohms, to provide series termination (SSTL) 
signaling. There are no caps present in the signal path. A first test was with 
no resistors in place, and produced the same results, but with minor overshoot, 
so the resistors were added.

The voltage regulator I refer to is the one built into the DFRobot adapter, 
which simply steps the +5V at the 6 pin connector down to +3.3V for the SD card 
to use.

Can you recommend an adapter (the one you use for testing?). Also, the specific 
mfgr/model of SD card, if you think this is important?

Thanks!

Original comment by ry...@rymar.com on 28 Oct 2013 at 8:44

GoogleCodeExporter commented 9 years ago
Just noticed the resistor dividers on the signaling from the DFRobot input 
pins, to the SDCard connector pins. This must be to make the adapter compatible 
with 5V signaling for the older Arduino boards. I will rework the adapter and 
post the results to this issue, as history for others attempting to use the 
DFRobot adapter with the Due, and SDFat.

Original comment by ry...@rymar.com on 28 Oct 2013 at 9:04

GoogleCodeExporter commented 9 years ago
I just find cheap breakout boards on ebay like these:

http://www.kooing.com/index.php?route=product/category&path=61_64

I have also used standard SD sockets from DigiKey soldered to a homemade PC 
board.

I test with a large variety of SD cards.

To get high performance you need to do very large block writes.

With a simple 8 GB SanDisk class 4 card like this:

http://www.newegg.com/Product/Product.aspx?Item=N82E16820171480

I get This result:

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

Original comment by Bill.Gre...@gmail.com on 28 Oct 2013 at 9:21

GoogleCodeExporter commented 9 years ago
Removing the resistor dividers from the DFRobot board fixes the issue; SDFat 
now runs all the way to full speed (42MHz)! The resistor dividers (4.7K and 
10K) provide way too much wave distortion to work. This issue is noted in the 
SDFat documentation...

The recommended SD sockets will work better, (and this is a bit off-topic for 
the SDFat library) but the image shows how to do the rework to the DFRobot 
board: remove each pair of resistors (6 total), and add a wire jumper to the 
left resistor position as shown.

Thanks for the support, and a clean, well-written library!

Original comment by ry...@rymar.com on 28 Oct 2013 at 9:41

Attachments: