Using SdFat to acces Teensy 3.6 SD internal card (& with audio board)

Status
Not open for further replies.
Hi Edwin,

thanks for clearing this up and thanks for the nice schematics!

Now I understand!

Yes, I tried the same with my setup (using the builtin Teensy ADC without audio board and using a separate 3V3 LDO regulator for the preamp and mic), but the clickings remained at 384/500ksps sample rate . . .

So there seems to be a different issue in my setup.

My suspicion would be:

* the SD card writes use a lot of current (more than the Teensy 3.6 voltage regulator can provide), this causes a drop on the Teensy 3V3 line, also a drop in the ADC reference voltage leading to spikes in the recordings

* the drop in ADC reference voltage can only be eliminated in my setup, if the SD card 3V3 voltage would be separated from the Teensy 3V3 line, making it necessary to cut the SD card trace of pin 4 and deliver the SD card with a separate voltage regulator . . .

In your setup with the audio board, the ADC is in the codec on the audio board, making it easy for you to provide different 3V3 lines for ADC and Teensy, so your problem is solved. My problem with the built-in ADC could however only be solved by "hacking" the Teensy SD card 3V3 line.

Thanks a lot for these insights, have fun with the Teensy!

Frank
 
I actually had been looking into the 3.3v supply of the SD card.

What I did was disconnecting the 3v3 pin of the SD card holder but dud not yet want to place an external voltage on that pin.

I inserted a 22ohm resistor in the 3v3 supply line of the sf card, and a 220uF cap was placed on the end of the SD card holder.
This reduced the click but did not eliminate it.
I think trying to supply the SD card with it's own voltage regulator should help to get the most noise out. I don't know if there is any other convenient way to separate the supply voltage. I did not find a good trace for that.

In the picture, in the middle line is the noise with a standard card and no modifications. The top line is with only a 220uF cap on the 3v3 line. The lowest line was with 3v3 seperated on the cardholder and te 22ohm 220uF cap.

image (4).jpg



I used my recordings up to 281k, over the last few weeks we had some warm evenings and I was still able to detect some bats. This device is a whole lot of fun.

This is my board (without the latest modifications)
image (5).png

Kind regards,

Edwin
 
Excellent information!

Thats exactly what I wanted to try out ;-).

How did you manage to solder the resistor and cap to the SD card pin 4 and simultaneously manage to be able to insert the SD card ? ;-). Seems to me a problem of space . . .

All the best,

Frank
 
I just lifted pin 4 of the board an inserted a fancy insulator (just a piece of paper) on this pin I soldered a very thin wire that connected to the capacitor and resistor.
You do need to keep that wire very thin.

Not a very solid connection but good enough for the experiment.

It would be nice if there was some layout so one knows where one could cut a trace to separate the sd-card supply.

I hope adding an external 3.3v supply works just was well for you as it did for me.
This image is my last test, using the worst SD card I had..... The flat line of course is a recording with the separate 3v3 supply for audioboard and microphone amplifier.
image (6).jpg
Edwin
 
Thanks for the info, I like this kind of fancy insulators ;-).

In the case I use, the write process to the SD card at 384ksps sample rate with a buffer of 8192 samples lasts about 3ms every 21ms. So, the RC filtering should be able to provide a time constant of at least 10ms and the resistor should be able to provide at least 150mA for the SD card (although I read in some forums that modern SDHC/SDXC cards tend to have peak currents of up to 450mA !).

With 22 Ohms, the current at 3V3 is 136mA and the time constant is 4.8ms.

Maybe I will try something like R = 10 Ohms (current of 330mA) and a C = 1000µF cap (RC time constant: 10ms) at pin 4 of the SD card.

But now its experimental time . . .

All the best,

Frank
 
Ah, I see now it comes down to the math and experiments.

I hope you will get the results you need Frank.
I just threw some things together and decided an extra voltage regulator was the best solution. If you find a way to place an external regulator it would save you the math.

I was amazed by the current drawn by these SD cards. Even when not writing there was quite some voltage drop over the resistor.

Maybe one of the Teensy designers could help out here since it seems it comes down to some hardware modification.

Good luck with your experiments.

Edwin
 
Dear DD4WH,
I'm reading this thread and I was wondering, did you ever get the Audio library working with a different SD library then the default one?

Thank you,

Best regards
 
Dear Chris,
Thank you for your solution. I have the Audio library working now with the SdFat library.
I didn't know you also needed to change some syntax when opening the file.
The long filenames is a very nice feature.Why isn't this standard in the SDK?

Unfortunately the SdFat is also not fast enough to reliable play two stereo wav files together. It does a much better job then SD library, but sometimes you get a nasty glitch sound when starting the second playSdWav player.

Code:
#ifdef USE_SdFat_
    wavfile.open(filename); // SdFat.h
#else
    wavfile = SD.open(filename); // SD.h
#endif
 
Status
Not open for further replies.
Back
Top