Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: Teensy 3.6 sd card

  1. #1
    Junior Member
    Join Date
    Jun 2017
    Posts
    8

    Teensy 3.6 sd card

    Hi to all!!
    Well,recently i bought teensy 3.6 and i would like to use its sd on board module.As i know before i use an sd card i have to format it to FAT32 system,so technically the max size of sd card should be 4Gb.So which is the max size of an sd card that i can use with teensy 3.6 with the help of sdfat library(is it only 4Gb??)??Thanks!

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,764
    IIRC - SD max size is 32 GB - I don't find a simple link to that - but I have used them.

    This link in the sources points to SDFormatter to download and get best usable card format.

  3. #3
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,665
    Quote Originally Posted by raindrop View Post
    Hi to all!!
    Well,recently i bought teensy 3.6 and i would like to use its sd on board module.As i know before i use an sd card i have to format it to FAT32 system,so technically the max size of sd card should be 4Gb.So which is the max size of an sd card that i can use with teensy 3.6 with the help of sdfat library(is it only 4Gb??)??Thanks!
    you can format uSD > 32 Gig with FAT32. only the cluster size, i.e. minimum file size is larger. 32 Gig is only standard x-over from Fat32 and exFAT
    I'm using T3.6 with 128 Gig uSD (256 Gig is still somewhat expensive for my taste) but formatted with exFAT. You can search the forum for exFAT and will find earlier (last year) discussions on uSDFS (which handles SDIO AND exFAT) and on Bill Greiman's SdFatlib (which handles also SDIO, but not sure about exFAT,as no hint in read-me file).

    The links are
    uSDFS:https://github.com/WMXZ-EU/uSDFS
    SdFatLib: https://github.com/greiman/SdFat

    From the forum discussion you may note that Bill's SdFatLib is more optimized for reading/writing/streaming small amount of data.

  4. #4
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,764
    Funny I got email about an @raindrop post that was pulled?

    ***************
    So i can forma a 32Gb sd card to FAT 32 and use it with sdfatlib?
    ***************
    Anyhow yes - follow my link to get the recommended tool to format a card up to 32GB for use with the standard SD library. Beyond that as WMXZ notes there are newer libraries that can go beyond 32GB - but even SD is not limited to 4GB by any means. The compromise is minimum file size from the larger underlying sectors/clusters needed to get the 4GB by design FAT32 system to get up to 32GB. So small files will not be able to fill the space without waste.

  5. #5
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    Could you tell which is the minimum file size when use 32 gb sd card formated to FAT32 and use standard sd card libraries??Thanks a lot!

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    11,764
    Offhand no - experiment with it. Look at free space and add a new file, look at free space and repeat a couple of times.

    If SDFormatter is used the UI may indicate the minimum Cluster size.

  7. #7
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,665
    Quote Originally Posted by raindrop View Post
    Could you tell which is the minimum file size when use 32 gb sd card formated to FAT32 and use standard sd card libraries??Thanks a lot!
    The minimum file size is equal the cluster size. The smallest cluster is 512 bytes. The largest cluster size (allocation block) on the SD formatting tool is 64 kB.
    officially supported (guaranteed to work) is up to 32 kB.

  8. #8
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    Quote Originally Posted by WMXZ View Post
    The minimum file size is equal the cluster size. The smallest cluster is 512 bytes. The largest cluster size (allocation block) on the SD formatting tool is 64 kB.
    officially supported (guaranteed to work) is up to 32 kB.
    So when i use 32Gb sd each read/write should be a buffer of 64Kb size instead of 512 buffer?

  9. #9
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,665
    Quote Originally Posted by raindrop View Post
    So when i use 32Gb sd each read/write should be a buffer of 64Kb size instead of 512 buffer?
    Buffersize is independent of disk cluster size (i.e-allocation unit, which defined during formatting). Buffersize depends on the amount of ram yo have available and type of data you read/write
    On T3.2 I use as buffer 8kB and on T3.6 I use 32 kB. That is, my read/writes are in chunk of 8 or 32 kB.

  10. #10
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    Quote Originally Posted by WMXZ View Post
    Buffersize is independent of disk cluster size (i.e-allocation unit, which defined during formatting). Buffersize depends on the amount of ram yo have available and type of data you read/write
    On T3.2 I use as buffer 8kB and on T3.6 I use 32 kB. That is, my read/writes are in chunk of 8 or 32 kB.
    I have noticed that teensy 3.6 has 4 bit spi.Does this feature supported by sdfat library?If no,how i can use it?Thanks

  11. #11
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,665
    Quote Originally Posted by raindrop View Post
    I have noticed that teensy 3.6 has 4 bit spi.Does this feature supported by sdfat library?If no,how i can use it?Thanks
    both SdFat and SD support 4 bit sdio. I think, both libraries have examples for sdio.

  12. #12
    Junior Member
    Join Date
    Jun 2017
    Posts
    8
    Quote Originally Posted by WMXZ View Post
    both SdFat and SD support 4 bit sdio. I think, both libraries have examples for sdio.
    I search for sdfat 4 bit sdio example but i am little confused.I would like to use readwrite example (https://github.com/greiman/SdFat/tree/master/examples) with 4 bit sdio.

  13. #13
    Senior Member
    Join Date
    Jul 2014
    Posts
    2,665
    Quote Originally Posted by raindrop View Post
    I search for sdfat 4 bit sdio example but i am little confused.I would like to use readwrite example (https://github.com/greiman/SdFat/tree/master/examples) with 4 bit sdio.
    I would start with TeensySdioDemo, understand the differences and merge with the readwrite example you are interested in.
    Last edited by WMXZ; 06-19-2017 at 12:57 PM.

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,079
    With the normal SD library, all you need to do is SD.begin(BUILTIN_SDCARD). The library will automatically use the 4 bit SDIO interface when you give it that option for SD.begin. Slow SPI mode is used when you give it a pin number for SD.begin(). Easy stuff.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •