Coder Social home page Coder Social logo

fat16's Introduction

Read changes.txt if you have used previous releases of this library.

Please read the html documentation for this library.  Start with
html/index.html and read the Main Page.  Next go to the Files tab and
read the documentation for Fat16Config.h.  Finally go to the Classes
tab and read the Fat16 class documentation.

If you wish to report bugs or have comments, send email to
[email protected]

Arduinos access SD cards using the cards SPI protocol.  PCs, Macs, and
most consumer devices use the 4-bit parallel SD protocol.  A card that
functions well on A PC or Mac may not work well on the Arduino.

Most cards have good SPI read performance but cards vary widely in SPI
write performance.  Write performance is limited by how efficiently the
card manages internal erase/remapping operations.  The Arduino cannot
optimize writes to reduce erase operations because of its limited RAM.

SanDisk cards generally have good write performance.  They seem to have
more internal RAM buffering than other cards and therefore can limit
the number of flash erase operations that the Arduino forces due to its
limited RAM.

Some Dane-Elec cards have a write speed that is only 20% as fast as
a good SanDisk card.


The hardware interface to the SD card should not use a resistor based
level shifter.  Fat16 sets the SPI bus frequency to 8 MHz which results
in signal rise times that are too slow for the edge detectors in many
newer SD card controllers when resistor voltage dividers are used.

The 5 to 3.3 V level shifter for 5 V arduinos should be IC based like
the  74HC4050N based circuit shown in the file SdLevel.png.  The
Adafruit Wave Shield uses a 74AHC125N.  Gravitech sells SD and MicroSD
Card Adapters based on the 74LCX245.


To install the library copy the Fat16 directory to the
libraries subdirectory of the Arduino user directory. On Windows 7
this is <User Name>\Documents\Arduino\libraries. On earlier versions of
the Arduino IDE use the hardware/libraries subdirectory of the
Arduino IDE.

For the AtMega168 be sure to reduce the serial buffer size by setting 
RX_BUFFER_SIZE to 32 or less in
hardware/cores/arduino/HardwareSerial.cpp.  I use 16.

Fat16 assumes chip select for the SD card is the hardware SS pin.  On a
168/328 Arduino this is pin 10 and on a Mega this is pin 53.  If you are
using another pin for chip select you will need call
SdCard::init(speed, chipSelectPin) with second parameter set to the
chip select pin.

If you have a shield like the SparkFun shield that uses pin 8 for chip
select you would change the line:
  card.init();
to
  card.init(0, 8);
in the SdFat examples.

You can also edit SdCard.h and change the default value for chip select.
Replace SPI_SS_PIN with the new value for chip select in the following
definition.

uint8_t const SD_CHIP_SELECT_PIN = SPI_SS_PIN;

For example to set SD_CHIP_SELECT_PIN to 8 for the SparkFun microSD shield:
uint8_t const SD_CHIP_SELECT_PIN = 8;

The best way to restore an SD card's format is to use SDFormatter
which can be downloaded from:

http://www.sdcard.org/consumers/formatter/

SDFormatter aligns flash erase boundaries with file
system structures which reduces write latency and file system overhead.

SDFormatter does not have an option for FAT type so it may format
small cards as FAT12.


The Fat16/examples directory has the following sketches.  They are my
debug sketches.

fat16AnalogLogger.pde - A simple data logger for one or more analog
                        pins.

fat16append.pde - This sketch creates a large file by successive
                  open/write/close operations using O_APPEND.

fat16bench.pde - A read/write benchmark.

fat16copy.pde - Copy the file created by fat16append.pde to the file
                ACOPY.TXT.

fat16GPS_CSVSensorLogger.pde - Ladyada's GPS logger modified to use
                               the Fat16 library.

fat16GPSLogger_v3.pde - Ladyada's GPS logger modified to use the Fat16
                        library.

fat16info.pde  - This Sketch attempts to initialize an SD card and
                 analyze its format.  Used for debug problems with
                 SD cards.

fat16ls.pde - A test of the ls() file list function.

fat16print.pde - This sketch shows how to use the Arduino Print class
                 with Fat16.

fat16read.pde  - This sketch reads and prints the file PRINT00.TXT
                 created by fat16print.pde or WRITE00.TXT created by
                 fat16write.pde.

fat16remove.pde - This sketch shows how to use remove() to delete the
                  file created by the fat16append.pde example.

fat16rewrite.pde - This sketch shows how to rewrite part of a line in
                   the middle of the file created by the
                   fat16append.pde example.

fat16tail.pde  - This sketch reads and prints the tail of all files
                 created by fat16append.pde, fat16print.pde and 
                 fat16write.pde.

fat16timestamp.pde - This sketch shows how to set file access, create,
                     and write/modify timestamps.

fat16truncate.pde - This sketch shows how to use truncate() to remove
                    the last half of the file created by the
                    fat16append.pde example.

fat16write.pde - This sketch creates a new file and writes 100 lines
                 to the file.

To access these examples from the Arduino development environment go to:
File -> Examples -> Fat16 -> <Sketch Name>

Compile, upload to your Arduino and click on Serial Monitor to run the
example.

You must use a standard SD card that has been formatted with a FAT16
file system.

Updated 2009-11-28

fat16's People

Contributors

greiman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fat16's Issues

About HARDLESS CNC

Hello friend, I was see in youtube a video for SD SEND FRO ONE ARDUINO TO GRBL MASTER ARDUINO A GCODE, this is the code that I need or could share the Master Files???

Now I working in similar project but I can't acces to me SD CARD, only can move and send commands.

image

Getting SD card error 2

Hi,

I tried to run the example fat16ls but without success. The program returned a SD card error 2. I use a 16 GB SD card, but the only partition in it was a 1GB FAT16 primary partition. It shouldn't work?

How to increase writing speed?

Hello,

how can I increase the overall writing speed of the SPI communication with my SD Card?
I used the SdFat Library for a comparison and i could write data on my SD Card every 2000 microseconds. With the Fat16 Library I can only reach about 8000 microseconds for writing data.

This is my small Arduino sketch I used:
Fat16 fastDataLogger_gitHubIssue.txt

Thanks for your help!

Does this support SD cards > 2 GB?

I've been trying to find how big of SD cards you can use with this library.

Does it work with files larger than 2 GB (i.e. FAT32?) The name of the library implies it is FAT16 only, but there seems to be some code that suggests it is compatible with all FAT types. Is this correct?

can block size be reduced to say 128 bytes?

i have a data logger app that only every writes in 80 byte blocks, once a second, i was wandering if its possible to reduce the size of this
union cache16_t {
/** Used to access cached file data blocks. */
uint8_t data[512];
to something like 128?

4GB FAT16 is not supported

Hi, I have used your library with 2GB SD cards and it works fine. It seems the library is not working with 4GB SD cards though. Could you guide me if library code needs some kind of changing?
Regards

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.