microSD slot on teensy 3.6

Status
Not open for further replies.
Since you are using the built-in SD socket and since this SD socket is wired to the SDIO interface you ABSOLUTELY MUST tell your SdFat_beta library to use the SDIO interface.

OK I believe I've got it now. And the corollary os this is the *ONLY* way to use the SPI interface and SdFat_beta (i.e. USE_SDIO = 0) is to attach another SD socket and wire it to one of the teensy's available SPI ports.

Your challenge is to verify that your selected SdFat library can be configured to use the SDIO interface and the built in SD Card socket.

As mentioned in several of my recent posts that's already working (using SdFat_beta with USE_SDIO = 1).

The downside of all this reality is I either have to port my old non-teensy code to use SDIO, or revert to SD library (and BUILTIN_SDCARD) which means I'll have to go back to 8.3 file names.

cheers
 
Last edited:
Yes, very sure.

sorry, I mistook "the main \libraries directory of the IDE" in oric_dan's post to mean the libraries directory under Sketches.

So no paranoia developing, all sorted :)

Can you answer my other question (please Paul):

"For my future reference - when the IDE pop-up offers library updates and the Library Manager lists "SD" as Updatable, should I ignore this ? It seems some of my difficulties arose because the teensyDuino SD library is not updated by this mechanism, and in fact get's hidden by the new Arduino version loaded into SKETCHES/libraries/SD directory by the Library Manager."
Is this correct?
 
Last edited:
sorry, I mistook "the main \libraries directory of the IDE" in oric_dan's post to mean the libraries directory under Sketches.

So no paranoia developing, all sorted :)

Can you answer my other question (please Paul):

"For my future reference - when the IDE pop-up offers library updates and the Library Manager lists "SD" as Updatable, should I ignore this ? It seems some of my difficulties arose because the teensyDuino SD library is not updated by this mechanism, and in fact get's hidden by the new Arduino version loaded into SKETCHES/libraries/SD directory by the Library Manager."
Is this correct?

I principally ignore what Arduino says and only update Teensy libraries via official teensyduino releases (including beta)
 
Gentlefolk,

I have been following this forum with interest as I have been having a lot of problems with SD cards on an Arduno UNO and the teensy 3.6.

I have decided to concentrate on the teensy 3.6. The environment is:
Hardware: An old Toshiba M500 laptop.
SD Card, various, formatted ith SD-formatter, all readable in other computers. Built in SD reader.
Linux Mint 18.1.
Arduino 1.8.1
TeensyduinoInstall-Linux 1.3.5
SdFat copied from https://forum.pjrc.com/threads/36737-Try-SdFat-forTeensy-3-5-3-6
49-teensy.rules installed.

SdInfo basic settings:
#include <SPI.h>
#include "SdFat.h"
// Set USE_SDIO to zero for SPI card access.
#define USE_SDIO 1


Compiled SdInfo clean.
Uploaded to the teensy. No errors.
The serial monitor displays:
Card type SDHC
Manufacturer ID, OEM, Product, Version, Serial number, Manufacturing date.
cardSize, flashEraseSize, eraseSingleBlock, OCR.
SD Partition table.

All the above look good and consistent everytime I access any card

On every card the following error is reported:

It is from "if (!sd.fsBegin()) at the end of SdInfo.
The error is "error: \nFile System initialisation."

I am not a c++ speaker and cannot decipher the "begin" code in FatFileSystem.h

Any help appreciated. iru
 
Have to tried File > Examples > SD > listfiles, of course with the pin number changed to BUILTIN_SDCARD?

Even if you never intend to use the Arduino SD library, you only wish to use SdFat, at least testing this way with the regular SD library can help show whether all the hardware is working, whether the problem is specific to something in SdFat.
 
Have to tried File > Examples > SD > listfiles, of course with the pin number changed to BUILTIN_SDCARD?

Even if you never intend to use the Arduino SD library, you only wish to use SdFat, at least testing this way with the regular SD library can help show whether all the hardware is working, whether the problem is specific to something in SdFat.

Thanks for the response. I have done the following:

Changed nothing, Same laptop, same cable, same teensy, same SD card. Nothing changed!

Compiled and uploaded "SDInfo". Same problem with Fat.

Compiled and uploaded " SD "listfiles". Error message: "Initialization error...initialization failed.".
Note: const int chipSelect = BUILTIN_SDCARD;

Compiled and uploaded "SDInfo". Same problem with Fat.

If someone can explain or simplify (break up the compact code) in FatFileSystem.h BEGIN I can probably hack my way around it to get better information.

Or is there some other program/code that may help?

This problem is consistent and reproducible. I just need some tools and help.

Once again thanks, iru.
 
In this case, i'd try to reformat the card (use the official SD-Tool "SdFormatter").
The examples work, so it's a problem somewhere with your setup.
 
Thank you for the response.

My SD card issues have been intermittent and various so I thought I have been careful about hat I have done.
The SD cards were formatted with the "SDFormatter" .

However your post I rechecked. Neither of the two cards I have been using could be accessed on Windows-7 or Linux.

I walked over to the local Mall and purchased a cheap 8 gig card (nice night for a walk).

Detected on Win-7, formatted with the "SDFormatter".

SdInfo works without error and reports "Volume is Fat32".

So what happened to the to original SD cards? I thought they were good.

Looks like more testintg......

Thanks once again, iru.
 
I've "always" had problems with SD cards on Arduinos, going back for years. Arduinos and Teensy run the same libraries. And even though Bill Greiman has been working on the libraries constantly. Some of the exact same errors have occurred going back to 2012 or so.

Some of these issues were discussed on recent threads I participated in. Even running the latest libraries, I consistently have the problem that I write the card using the Teensy, but then when trying to read the cards on my Win7 or Win10 laptops, they say there is some error on the card that needs "fixing". Sometimes I get FILECHECK errors after writing, eg these are on the card I am currently using in the T3.6 dedicated slot:

> FOUND.000/
> FILE0000.CHK 2326528
> FOUND.001/
> FILE0000.CHK 32768
> FILE0001.CHK 32768
> FILE0002.CHK 32768

Greiman has always recommended:
1. format using SDformatter, and NOT Windows.
2. making sure you don't have a counterfeit knockoff card, usually shown by the FAT listing.

Further, from my experiences, I'd say,
3. NEVER EVER NEVER plug an SD card into an Arduino/Teensy that has important data on it; use only dedicated cards that are not used for anything else.
4. don't try to run SD cards on the same SPI port with anything else, like LCDs or other SPI devices, it's a bag of endless conflicts.
5. if you buy any of those little SD Card modules from ebay/etc, note that some of them have smt Rs to interface to the uC, and some of them have a chip; the ones with the chip will not release the MISO pin.

EDIT: there is one other issue to mention,

6. this shouldn't be a problem with the T3.5,3.6 SD slot, but in regards item 4 sharing the SPI buss, SD cards do not automatically release the MISO pin; there was a discussion of this a couple of years ago on the Arduino forum. The apparent solution turned out to be [IIRC] to send a few clock pulses to the SD Card "after" SD-CS is de-asserted, and before CS on any other device is asserted. I recall Bill Greiman saying he had incorporated this fixx into his libraries. I don't know about other libraries.

OK, so these are just some of my own suggestions, and you're always free to do what you want of course, :). There are ways around the issue of item 4, but it may take some work.
 
Last edited:
Thanks for the information and recommendations.

Your comments reflect my experience. Inconsistent behavior, loss of data, etc.
This was compounded by multiple libraries and versions of libraries.

It looks like I will have to be very careful!

Thanks, iru.
 
Gentlfolk,

I am still having troubles creating a file and I am getting lost in the libraries.....

Can anyone tell me how to get a display of the compile/linking process so that I can check what libraries are used?

When are libraries compiled? I would like to insert some basic trace/display code so I can see what happens where.

Thanks, iru
 
Status
Not open for further replies.
Back
Top