Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. This is a beta version of SdFat with support for Software SPI on
  2. AVR, Due, and Teensy 3.1 boards. SPI transactions are also supported.
  3. See SoftwareSPI.txt and SPI_Transactions.txt for more information.
  4. Please check the changes.txt file!
  5. For those who don't like too much documentation read QuickStart.txt.
  6. The Arduino SdFat library provides read/write access to FAT16/FAT32
  7. file systems on SD/SDHC flash cards.
  8. SdFat requires Arduino 1.05 or greater.
  9. To use SdFat, unzip the download file and place the SdFat folder
  10. into the libraries subfolder in your main sketch folder. You may
  11. need to create the libraries folder. Restart the Arduino IDE if
  12. it was open. See the Arduino site for more details om installing libraries.
  13. The default chip select for the SD card is the hardware SS pin. On a
  14. 168/328 Arduino this is pin 10 and on a Mega this is pin 53. If you are
  15. using another pin for chip select you will need call SdFat::begin(chipSelectPin)
  16. or SdFat::begin(chipSelectPin, sckRateID) with second parameter set to the
  17. SPI rate ID.
  18. If you have a shield like the SparkFun shield that uses pin 8 for chip
  19. select you would change the line:
  20. sd.begin();
  21. to
  22. sd.begin(8);
  23. or
  24. sd.begin(8, SPI_HALF_SPEED);
  25. to use a slower SPI clock.
  26. If the example uses
  27. sd.init();
  28. change it to:
  29. sd.begin(8, SPI_FULL_SPEED);
  30. A number of configuration options can be set by editing SdFatConfig.h
  31. #define macros. Options include:
  32. USE_SD_CRC - enable or disable SD card crc checking.
  33. USE_MULTIPLE_CARDS - enable or disable use of multiple SD card sockets.
  34. USE_SERIAL_FOR_STD_OUT - use Serial for the default stdOut.
  35. ENDL_CALLS_FLUSH - enable a flush() call after endl.
  36. SPI_SCK_INIT_DIVISOR - set the SPI rate for card initialization.
  37. LEONARDO_SOFT_SPI - use software SPI on Leonardo Arduinos.
  38. MEGA_SOFT_SPI - use software SPI on Mega Arduinos.
  39. USE_SOFTWARE_SPI - always use software SPI.
  40. If you wish to report bugs or have comments, send email to
  41. fat16lib@sbcglobal.net
  42. Read changes.txt if you have used previous releases of this library.
  43. Read troubleshooting.txt for common hardware problems.
  44. Please read the html documentation for this library. Start with
  45. html/index.html and read the Main Page. Next go to the Classes tab and
  46. read the documentation for the classes SdFat, SdFile, ifstream, ofstream.
  47. The SdFile class implements binary files similar to Linux's system calls.
  48. The StdioStream class implements buffered I/O for similar to Linux stdio.h.
  49. StdioStream is under development so expect changes and bugs.
  50. The classes ifstream, ofstream, istream, and ostream follow the
  51. C++ iostream standard when possible.
  52. Many examples are included in the SdFat/examples folder.
  53. There are many tutorials and much documentation about using C++ iostreams
  54. on the web.
  55. http://www.cplusplus.com/ is a good C++ site for learning iostreams.
  56. Arduinos access SD cards using the cards SPI protocol. PCs, Macs, and
  57. most consumer devices use the 4-bit parallel SD protocol. A card that
  58. functions well on A PC or Mac may not work well on the Arduino.
  59. Most cards have good SPI read performance but cards vary widely in SPI
  60. write performance. Write performance is limited by how efficiently the
  61. card manages internal erase/remapping operations. The Arduino cannot
  62. optimize writes to reduce erase operations because of its limited RAM.
  63. SanDisk cards generally have good write performance. They seem to have
  64. more internal RAM buffering than other cards and therefore can limit
  65. the number of flash erase operations that the Arduino forces due to its
  66. limited RAM.
  67. The hardware interface to the SD card should not use a resistor based
  68. level shifter. SdFat sets the SPI bus frequency to 8 MHz which results
  69. in signal rise times that are too slow for the edge detectors in many
  70. newer SD card controllers when resistor voltage dividers are used.
  71. The 5 to 3.3 V level shifter for 5 V arduinos should be IC based like
  72. the 74HC4050N based circuit shown in the file SdLevel.png. The
  73. Adafruit Wave Shield uses a 74AHC125N. Gravitech sells SD and MicroSD
  74. Card Adapters based on the 74LCX245.
  75. If you are using a resistor based level shifter and are having problems
  76. try setting the SPI bus frequency to 4 MHz. This can be done by using
  77. card.init(SPI_HALF_SPEED) to initialize the SD card.
  78. A feature to use software SPI is available. Software SPI is slower
  79. than hardware SPI but allows any digital pins to be used. See
  80. SdFatConfig.h for software SPI definitions.
  81. An many shields designed for an Uno can be use on an Arduino Mega
  82. by defining MEGA_SOFT_SPI in SdFatConfig.h.
  83. The best way to restore an SD card's format is to use SDFormatter
  84. which can be downloaded from:
  85. http://www.sdcard.org/consumers/formatter/
  86. SDFormatter aligns flash erase boundaries with file
  87. system structures which reduces write latency and file system overhead.
  88. SDFormatter does not have an option for FAT type so it may format
  89. small cards as FAT12.
  90. The example sketch SdFatFormatter.ino will format smaller cards FAT16
  91. so they can be used with SdFat.
  92. The SdFatTestSuite folder contains development tests.
  93. The SdFat/examples folder has the following sketches. Older examples
  94. and test programs are in the examples/#attic folder.
  95. AnalogBinLogger - Fast AVR ADC logger - see the AnalogBinLoggerExtras folder.
  96. bench - A read/write benchmark.
  97. cin_cout - Demo of ArduinoInStream and ArduinoOutStream.
  98. dataLogger - A simple modifiable data logger.
  99. directoryFunctions - Demo of chdir(), ls(), mkdir(), and rmdir().
  100. fgets - Demo of the fgets read line/string function.
  101. formating - Print a table with various formatting options.
  102. getline - Example of getline from section 27.7.1.3 of the C++ standard.
  103. LowLatencyLogger - A modifiable data logger for higher data rates.
  104. OpenNext - Open all files in the root dir and print their filename.
  105. PrintBenchmark - A simple benchmark for printing to a text file.
  106. QuickStart - A sketch to quickly test your SD card and SD shield/module.
  107. RawWrite - A test of raw write functions for contiguous files.
  108. readCSV - Read a comma-separated value file using iostream extractors.
  109. ReadWriteSdFat - SdFat version of Arduino SD ReadWrite example.
  110. rename - A demo of SdFat::rename(old, new) and SdFile::rename(dirFile, newPath).
  111. SdFormatter - This sketch will format an SD or SDHC card.
  112. SdInfo - Initialize an SD card and analyze its structure for trouble shooting.
  113. StressTest - Create and write files until the SD is full.
  114. Timestamp - Sets file create, modify, and access timestamps.
  115. TwoCards - Example using two SD cards.
  116. To access these examples from the Arduino development environment
  117. go to: File -> Examples -> SdFat -> <Sketch Name>
  118. Compile, upload to your Arduino and click on Serial Monitor to run
  119. the example.
  120. Updated 06 Aug 2014