Re: FAT32/SDHC library for Wave and other shields

by fat16lib on Thu Jun 11, 2009 10:42 pm

This still has nothing to do with format or card size.

This card did go into SPI mode but failed on the first command at full SPI speed. This is the command to read an internal register that gives card characteristics.

This happens with cards that can't function at full SPI speed, which is required for playing wave files.
fat16lib
 
Posts: 591
Joined: Wed Dec 24, 2008 12:54 pm

Re: FAT32/SDHC library for Wave and other shields

by zachtos on Thu Jun 11, 2009 10:51 pm

well, $35 lost, let's try anothr $55. Do you think 10 of these will work? hope so since I'm ordering them. I guess that's what I get for going banned... I guess.

http://www.newegg.com/Product/Product.aspx?Item=N82E16820326001 hp 1gb
zachtos
 
Posts: 77
Joined: Sun May 03, 2009 7:18 pm

Re: FAT32/SDHC library for Wave and other shields

by adafruit on Fri Jun 12, 2009 12:05 am

i'd buy one. please let us know if it works!
User avatar
adafruit
 
Posts: 11508
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: FAT32/SDHC library for Wave and other shields

by fat16lib on Fri Jun 12, 2009 8:40 am

zachtos,

There is almost no way to tell if a card will work without trying it. Manufactures make changes often and don't change the part number. Your working card is Version 3.7 of a product they call SD02G.

I have an old 16 MB card that came with a Canon camera. I use it for testing and it never fails. It came formatted FAT12 and I forced it to be FAT16 by using very small clusters. It is still fast enough to play wave files.

I would love to have one or two of your 128 MB cards for testing. Send me a PM so I can arrange to buy them.

Finally here is what makes or breaks the use of a card. The small InCOMM chip in the picture below is the flash controller. This is the part that provides the SPI interface. There are many versions of this part from at least six semiconductor companies. It is really hard to get data sheets for these parts. I have found a few by searching Chinese sites for part numbers.

Here is the picture:
Attachments
SdInside.png
SdInside.png (630.64 KiB) Viewed 6901 times
fat16lib
 
Posts: 591
Joined: Wed Dec 24, 2008 12:54 pm

Re: FAT32/SDHC library for Wave and other shields

by zachtos on Tue Jun 16, 2009 9:15 pm

New card doesnt work either!!!! SO ANGRY@@$!@!! $$100 gone total now and nothing to show for it.
Code: Select all
init time: 39

Card type: SD1

readCID failedSD error

errorCode: 10

errorData: D


one from prior post, HP 1gb, formatted using the aformentioned utility and vista format to fat16 w/ 32kb clusters, no avail

I may be able to return this one, but I am stuck w/ the 128mb unless someone wants to buy them.

http://www.newegg.com/Product/Product.a ... 6820208043
$6 ea newegg

http://www.transcendusa.com/Support/DLC ... SxxSDC.pdf
datasheet

will this one work? of course, I forgot, no one can tell me...

I bought 10 of these areduino waveshields, I'm spending more on SD cards then the #@$@# shields, how about a refund for such a frustrating product...??? perhaps I should have stuck with ISD recorders afterall.
zachtos
 
Posts: 77
Joined: Sun May 03, 2009 7:18 pm

Re: FAT32/SDHC library for Wave and other shields

by zachtos on Wed Jun 17, 2009 9:31 pm

WELL I"LL BE DAMNED!

the new v1.1 board can play all those 'broken' SD cards of mine! V1.0 can not! good day sir.
zachtos
 
Posts: 77
Joined: Sun May 03, 2009 7:18 pm

Re: FAT32/SDHC library for Wave and other shields

by THW Mark on Fri Jul 03, 2009 2:22 pm

@fat16lib

in your current google code, the pispeak example has a definition for "redled". This is not used in the code, as far as i can see. So I think you can remove that from the example.

Great work at the lib by the way! :)
THW Mark
 
Posts: 36
Joined: Wed Aug 29, 2007 5:33 am
Location: Delft, Netherlands

Re: FAT32/SDHC library for Wave and other shields

by fat16lib on Sat Jul 04, 2009 12:05 pm

THW Mark,

I just did minimal mods to ladyada's pispeak. I didn't catch that extra #define.
fat16lib
 
Posts: 591
Joined: Wed Dec 24, 2008 12:54 pm

Re: FAT32/SDHC library for Wave and other shields

by THW Mark on Sat Jul 04, 2009 3:59 pm

ah ok :) i started with your lib directly, so i didnt notice. i was just wondering what that define was doing there :)
THW Mark
 
Posts: 36
Joined: Wed Aug 29, 2007 5:33 am
Location: Delft, Netherlands

Re: FAT32/SDHC library for Wave and other shields

by Chief Robot on Sat Jul 11, 2009 8:26 pm

Hi,
I was successfully using a ProSpec 1GB card, but suddenly it stopped working.
I can view it on my desktop with my card reader fine.
I bought a new card as someone here recommended some that worked. I bought a Sandisk 4 GB SDHC card , but that doesn't work either. I can't run the test program as a file seems to be missing - SdCard.h My card reader also does not read the new card. I have 4 cards total and they are all different, but all give me the same error.

Wave test!
Free RAM: 1173
Card init. failed!
SD I/O error: 1, 0

Am I doing something wrong?
Thanks.
User avatar
Chief Robot
 
Posts: 37
Joined: Wed Jun 25, 2008 7:04 pm

Re: FAT32/SDHC library for Wave and other shields

by fat16lib on Sun Jul 12, 2009 7:16 am

Are you using the latest version of the library, WaveHC, and test sketch, SdReadTest.pde? You must run WaveHC and SdReadTest.pde from the latest version of the download file.

If you are using wavehc20090519 or later read the changes.txt file. The class SdCard became SdReader so that WaveHC could be used with another library that was already using that name.

Error code 1 means that the card does not respond to the first command which sets the card to SPI mode. The error codes for the SD card are in the file SdReader.h.

This error means there is a fundamental hardware problem that has nothing to do with the SD card's format.

The fact that four types of SD cards fail suggest there is some problem with with the Arduino/Wave Shield. Look at all of the solder joints and make sure the shield is plugged into the Arduino correctly. I had one problem where the pins were plugged in "off by one".

It is hard to help more since there is so little information when the SD card fails on the first command.
fat16lib
 
Posts: 591
Joined: Wed Dec 24, 2008 12:54 pm

Re: FAT32/SDHC library for Wave and other shields

by Madeleine on Tue Jul 14, 2009 5:19 am

Question: How fast is the _expected_ overhead seektime to open up a file before starting to play it?

I've timed (with millis()) the time to do a

file.open(root, fname)

and it takes everything in between 4 and 99 milliseconds.

4 is rather ok, 99 is a bit too long for concatenating sounds.

How can I speed this up?

By pre-opening the next file? (Gets rather nasty, codewise but could be solved with some sort of playqueue)
Get a faster card? Or is that wasted money?
By doing anything else?
Madeleine
 
Posts: 4
Joined: Thu Jun 04, 2009 1:33 am

Re: FAT32/SDHC library for Wave and other shields

by fat16lib on Tue Jul 14, 2009 7:35 am

You can't speed it up reliably. SD cards have terrible latency when you start to read in a new area. The read latency can be up to 100 ms. The delays happen at random times as the SD controller tries to optimize read ahead.

In the worst case opening a file could take much longer than 100ms. Use the root directory and have the minimum number of files possible.

Here is part of the SD spec on latency:

4.6.2.1 Read
For a Standard Capacity SD Memory Card, the times after which a timeout condition for read operations occurs are (card independent) either 100 times longer than the typical access times for these operations given below or 100 ms (the lower of the two). The host should use 100 ms timeout (minimum) for single and multiple read operations rather than using TAAC and NSAC.


Faster cards have higher sustained transfer rate but still have the same latency start-up glitches. The Arduino is too slow to take advantage of higher transfer rates.

You may get some advantage by opening a number of files. The only limit on the number that can be open is the amount of RAM you want to use. I think it takes about 30 bytes per file. If you play an open file a second time be sure to call rewind() before playing it again.

Also there will be latency when you call create(file). It needs to read the wave file meta-data and pre-buffer data.
fat16lib
 
Posts: 591
Joined: Wed Dec 24, 2008 12:54 pm

Re: FAT32/SDHC library for Wave and other shields

by Madeleine on Tue Jul 14, 2009 7:58 am

Thanks for an utterly informed answer. I think I will elaborate on my playqueue and spend some time opening files in advance. I concatenate phrases & words (like tts, but just the generation of speech based on arduino input/calc) and do not really want to much pause between them.

Minimizing the files to e.g. syllables+words is not an option as I have to have too much data in the application instead.
Madeleine
 
Posts: 4
Joined: Thu Jun 04, 2009 1:33 am

Re: FAT32/SDHC library for Wave and other shields

by ericzundel on Tue Aug 25, 2009 2:51 am

Hi I read through the WaveHC docs and the thread here and didn't see an answer to this question, so here goes.

I was really hoping it would be possible to read from 2 files at the same time. What I've done is combined the sample program dap_hc.pde with my own code for reading files that contain data to output onto an LED matrix. While I can get either to work on their own, I get SD I/O errors (somtimes error 3, sometimes error 10) if I try to run both reads in parallel. each loop loops similar:

- loop through the root directory until you find a file ending in .wav (or .led)
- Open a FatReader on that file
- Pass the periodically pull in data from the FAT reader.

I notice that if i'm scanning the directory while the wave file is running, the audio stutters. If I check the error status with the sdError() function from the demo sketch, it returns the i/o error (and halts the program).

My theory is that the FatReader/SdReader might towrk, but the problem lies in the fact that the Wave library relies on an interrupt and the interrupt may be causing re-entrancy in the library. If that's the problem, I could work around that by changing the interrupt code to work a different way.

So I guess what I'm asking is, "should I be able to get this to work with the WaveHC library" as is, is it possible but would take a lot of work, or is it just practically impossible.

Thanks a million,
-Eric.
User avatar
ericzundel
 
Posts: 38
Joined: Thu Aug 06, 2009 9:42 pm