Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.html 16KB

il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
il y a 5 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.14"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>SdFat: Arduino SdFat Library</title>
  9. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="jquery.js"></script>
  11. <script type="text/javascript" src="dynsections.js"></script>
  12. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="search/searchdata.js"></script>
  14. <script type="text/javascript" src="search/search.js"></script>
  15. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  16. </head>
  17. <body>
  18. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  19. <div id="titlearea">
  20. <table cellspacing="0" cellpadding="0">
  21. <tbody>
  22. <tr style="height: 56px;">
  23. <td id="projectalign" style="padding-left: 0.5em;">
  24. <div id="projectname">SdFat
  25. </div>
  26. </td>
  27. </tr>
  28. </tbody>
  29. </table>
  30. </div>
  31. <!-- end header part -->
  32. <!-- Generated by Doxygen 1.8.14 -->
  33. <script type="text/javascript">
  34. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  35. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  36. /* @license-end */
  37. </script>
  38. <script type="text/javascript" src="menudata.js"></script>
  39. <script type="text/javascript" src="menu.js"></script>
  40. <script type="text/javascript">
  41. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  42. $(function() {
  43. initMenu('',true,false,'search.php','Search');
  44. $(document).ready(function() { init_search(); });
  45. });
  46. /* @license-end */</script>
  47. <div id="main-nav"></div>
  48. </div><!-- top -->
  49. <!-- window showing the filter options -->
  50. <div id="MSearchSelectWindow"
  51. onmouseover="return searchBox.OnSearchSelectShow()"
  52. onmouseout="return searchBox.OnSearchSelectHide()"
  53. onkeydown="return searchBox.OnSearchSelectKey(event)">
  54. </div>
  55. <!-- iframe showing the search results (closed by default) -->
  56. <div id="MSearchResultsWindow">
  57. <iframe src="javascript:void(0)" frameborder="0"
  58. name="MSearchResults" id="MSearchResults">
  59. </iframe>
  60. </div>
  61. <div class="header">
  62. <div class="headertitle">
  63. <div class="title">Arduino SdFat Library </div> </div>
  64. </div><!--header-->
  65. <div class="contents">
  66. <div class="textblock"><p>Copyright (c) 2011-2019 Bill Greiman This file is part of the SdFat library for SD memory cards.</p>
  67. <p>MIT License</p>
  68. <p>Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:</p>
  69. <p>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.</p>
  70. <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. <br />
  71. </p>
  72. <h1><a class="anchor" id="Warn"></a>
  73. Warnings for SdFat V2 Alpha/Beta</h1>
  74. <p>This is a development version of SdFat V2 and any feature may change. There are bound to be serious bugs, and stability/compatibility problems. <br />
  75. Initially this is closer to an alpha test so expect stability problems.</p>
  76. <p>You can help by posting issues for bugs you find. I am doing a great deal of testing but actual applications make the best test cases.</p>
  77. <p>Please try to isolate the bug and post code that demonstrates the bug.</p>
  78. <p>The purpose of this release is to get feedback on features and address compatibility problems.</p>
  79. <p>You should edit <a class="el" href="_sd_fat_config_8h.html" title="configuration definitions ">SdFatConfig.h</a> to select features. <a class="el" href="_sd_fat_config_8h.html" title="configuration definitions ">SdFatConfig.h</a> is suitable for UNO and other small AVR boards.</p>
  80. <h1><a class="anchor" id="Intro"></a>
  81. Introduction</h1>
  82. <p>The Arduino SdFat library supports FAT16, FAT32, and exFAT file systems on Standard SD, SDHC, and SDXC cards.</p>
  83. <p>In SdFat version 1, SdFat and File are the main classes.</p>
  84. <p>In SdFat version 2, SdFat and File are defined by typedefs in terms of the following classes.</p>
  85. <p>The file system classes in the SdFat library are <a class="el" href="class_sd_fat32.html" title="SD file system class for FAT volumes. ">SdFat32</a>, <a class="el" href="class_sd_ex_fat.html" title="SD file system class for exFAT volumes. ">SdExFat</a>, and <a class="el" href="class_sd_fs.html" title="SD file system class for FAT16, FAT32, and exFAT volumes. ">SdFs</a>. <a class="el" href="class_sd_fat32.html" title="SD file system class for FAT volumes. ">SdFat32</a> supports FAT16 and FAT32. <a class="el" href="class_sd_ex_fat.html" title="SD file system class for exFAT volumes. ">SdExFat</a> supports exFAT, <a class="el" href="class_sd_fs.html" title="SD file system class for FAT16, FAT32, and exFAT volumes. ">SdFs</a> supports FAT16, FAT32, and exFAT.</p>
  86. <p>The corresponding file classes are <a class="el" href="class_file32.html" title="FAT16/FAT32 file with Arduino Stream. ">File32</a>, <a class="el" href="class_ex_file.html" title="exFAT file with Arduino Stream. ">ExFile</a>, and <a class="el" href="class_fs_file.html" title="FsBaseFile file with Arduino Stream. ">FsFile</a>.</p>
  87. <p>The types for SdFat and File are defined in <a class="el" href="_sd_fat_config_8h.html" title="configuration definitions ">SdFatConfig.h</a>. This version uses FAT16/FAT32 for small AVR boards and FAT16/FAT32/exFAT for all other boards.</p>
  88. <div class="fragment"><div class="line"><span class="comment">// File types for SdFat, File, SdFile, SdBaseFile, fstream,</span></div><div class="line"><span class="comment">// ifstream, and ofstream.</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="comment">// Set SDFAT_FILE_TYPE to:</span></div><div class="line"><span class="comment">// 1 for FAT16/FAT32, 2 for exFAT, 3 for FAT16/FAT32 and exFAT.</span></div><div class="line"><span class="comment">//</span></div><div class="line"><span class="preprocessor">#if defined(__AVR__) &amp;&amp; FLASHEND &lt; 0X8000</span></div><div class="line"><span class="comment">// FAT16/FAT32 for 32K AVR boards.</span></div><div class="line"><span class="preprocessor">#define SDFAT_FILE_TYPE 1</span></div><div class="line"><span class="preprocessor">#else // defined(__AVR__) &amp;&amp; FLASHEND &lt; 0X8000</span></div><div class="line"><span class="comment">// FAT16/FAT32 and exFAT for all other boards.</span></div><div class="line"><span class="preprocessor">#define SDFAT_FILE_TYPE 3</span></div><div class="line"><span class="preprocessor">#endif // defined(__AVR__) &amp;&amp; FLASHEND &lt; 0X8000</span></div></div><!-- fragment --><p>It is possible to use option three, support or FAT16/FAT32 and exFat on an Uno or other AVR board with 32KB flash and 2KB SRAM but memory will be very limited.</p>
  89. <p>Uno memory use for a simple data logger is:</p>
  90. <blockquote class="doxtable">
  91. <p>option 1, FAT16/FAT32, 11902 bytes of flash and 855 bytes of SRAM.</p>
  92. <p>option 2, exFAT, 14942 bytes of flash and 895 bytes of SRAM.</p>
  93. <p>option 3, FAT16/FAT32 and exFAT, 21834 bytes of flash and 908 bytes of SRAM. </p>
  94. </blockquote>
  95. <p>Please read documentation under the above classes tab for more information.</p>
  96. <p>A number of example are provided in the SdFat/examples folder. These were developed to test SdFat and illustrate its use.</p>
  97. <h1><a class="anchor" id="exFAT"></a>
  98. exFAT Features</h1>
  99. <p>exFAT has many features not available in FAT16/FAT32.</p>
  100. <p>Files larger than 4GiB, 64-bit file size and file position.</p>
  101. <p>Free space allocation performance improved by using a free space bitmap.</p>
  102. <p>Removal of the physical "." and ".." directory entries that appear in FAT16/FAT32 subdirectories.</p>
  103. <p>Better support for large flash pages with boundary alignment offsets for the FAT table and data region.</p>
  104. <p>exFAT files have two separate 64-bit length fields. The DataLength field indicate how much space is allocate to the file. The ValidDataLength field indicates how much actual data has been written to the file.</p>
  105. <p>An exFAT file can be contiguous with pre-allocate clusters and bypass the use of the FAT table. In this case the contiguous flag is set in the directory entry. This allows an entire file to be written as one large multi-block write.</p>
  106. <h1><a class="anchor" id="SDPath"></a>
  107. Paths and Working Directories</h1>
  108. <p>Relative paths in SdFat are resolved in a manner similar to Windows.</p>
  109. <p>Each instance of <a class="el" href="class_sd_fat32.html" title="SD file system class for FAT volumes. ">SdFat32</a>, <a class="el" href="class_sd_ex_fat.html" title="SD file system class for exFAT volumes. ">SdExFat</a>, and <a class="el" href="class_sd_fs.html" title="SD file system class for FAT16, FAT32, and exFAT volumes. ">SdFs</a> has a current directory. <br />
  110. This directory is called the volume working directory, vwd. <br />
  111. Initially this directory is the root directory for the volume.</p>
  112. <p>The volume working directory is changed by calling the chdir(path).</p>
  113. <p>The call sd.chdir("/2014") will change the volume working directory for sd to "/2014", assuming "/2014" exists.</p>
  114. <p>Relative paths for member functions are resolved by starting at the volume working directory.</p>
  115. <p>For example, the call sd.mkdir("April") will create the directory "/2014/April" assuming the volume working directory is "/2014".</p>
  116. <p>There is current working directory, cwd, that is used to resolve paths for file.open() calls.</p>
  117. <p>For a single SD card, the current working directory is always the volume working directory for that card.</p>
  118. <p>For multiple SD cards the current working directory is set to the volume working directory of a card by calling the chvol() member function. The chvol() call is like the Windows &lt;drive letter&gt;: command.</p>
  119. <p>The call sd2.chvol() will set the current working directory to the volume working directory for sd2.</p>
  120. <p>If the volume working directory for sd2 is "/music" the call</p>
  121. <p>file.open("BigBand.wav", O_READ);</p>
  122. <p>will open "/music/BigBand.wav" on sd2.</p>
  123. <h1><a class="anchor" id="Install"></a>
  124. Installation</h1>
  125. <p>You must manually install SdFat by renaming the download folder SdFat and copy the SdFat folder to the Arduino libraries folder in your sketchbook folder.</p>
  126. <p>It will be necessary to unzip and rename the folder if you download a zip file from GitHub.</p>
  127. <p>See the Manual installation section of this guide.</p>
  128. <p><a href="http://arduino.cc/en/Guide/Libraries">http://arduino.cc/en/Guide/Libraries</a></p>
  129. <h1><a class="anchor" id="SDconfig"></a>
  130. SdFat Configuration</h1>
  131. <p>Several configuration options may be changed by editing the <a class="el" href="_sd_fat_config_8h.html" title="configuration definitions ">SdFatConfig.h</a> file in the SdFat/src folder.</p>
  132. <p>Here are a few of the key options.</p>
  133. <p>If the symbol ENABLE_DEDICATED_SPI is nonzero, multi-block SD I/O may be used for better performance. The SPI bus may not be shared with other devices in this mode.</p>
  134. <p>The symbol SPI_DRIVER_SELECT is used to select the SPI driver.</p>
  135. <blockquote class="doxtable">
  136. <p>If the symbol SPI_DRIVER_SELECT is:</p>
  137. <p>0 - An optimized custom SPI driver is used if it exists else the standard library driver is used.</p>
  138. <p>1 - The standard library driver is always used.</p>
  139. <p>2 - The software SPI driver is always used. </p>
  140. </blockquote>
  141. <p>To enable SD card CRC checking in SPI mode set USE_SD_CRC nonzero.</p>
  142. <p>See <a class="el" href="_sd_fat_config_8h.html" title="configuration definitions ">SdFatConfig.h</a> for other options.</p>
  143. <h1><a class="anchor" id="Hardware"></a>
  144. Hardware Configuration</h1>
  145. <p>The hardware interface to the SD card should not use a resistor based level shifter. Resistor based level shifters results in signal rise times that are too slow for many newer SD cards.</p>
  146. <h1><a class="anchor" id="HowTo"></a>
  147. How to format SD Cards as FAT Volumes</h1>
  148. <p>The best way to restore an SD card's format on a PC or Mac is to use SDFormatter which can be downloaded from:</p>
  149. <p><a href="http://www.sdcard.org/downloads">http://www.sdcard.org/downloads</a></p>
  150. <p>A formatter program, SdFormatter.ino, is included in the SdFat/examples/SdFormatter directory. This program attempts to emulate SD Association's SDFormatter.</p>
  151. <p>SDFormatter aligns flash erase boundaries with file system structures which reduces write latency and file system overhead.</p>
  152. <p>The PC/Mac SDFormatter does not have an option for FAT type so it may format very small cards as FAT12. Use the SdFormatter example to force FAT16 formatting of small cards.</p>
  153. <p>Do not format the SD card with an OS utility, OS utilities do not format SD cards in conformance with the SD standard.</p>
  154. <p>You should use a freshly formatted SD card for best performance. FAT file systems become slower if many files have been created and deleted. This is because the directory entry for a deleted file is marked as deleted, but is not deleted. When a new file is created, these entries must be scanned before creating the file. Also files can become fragmented which causes reads and writes to be slower.</p>
  155. <h1><a class="anchor" id="ExampleFiles"></a>
  156. Examples</h1>
  157. <p>A number of examples are provided in the SdFat/examples folder.</p>
  158. <p>To access these examples from the Arduino development environment go to: File -&gt; Examples -&gt; SdFat -&gt; &lt;program Name&gt;</p>
  159. <p>Compile, upload to your Arduino and click on Serial Monitor to run the example.</p>
  160. <p>Here is a list:</p>
  161. <p>AvrAdcLogger - Fast AVR ADC logger using Timer/ADC interrupts.</p>
  162. <p>BackwardCompatibility - Demonstrate SD.h compatibility with SdFat.h.</p>
  163. <p>bench - A read/write benchmark.</p>
  164. <p><a class="el" href="class_buffered_print.html" title="Fast buffered print template. ">BufferedPrint</a> - Demo a buffered print class for AVR loggers.</p>
  165. <p>debug folder - Some of my debug programs - will be remove in the future.</p>
  166. <p>DirectoryFunctions - Use of chdir(), ls(), mkdir(), and rmdir().</p>
  167. <p>examplesV1 folder - Examples from SdFat V1 for compatibility tests.</p>
  168. <p>ExFatFormatter - Produces optimal exFAT format for smaller SD cards.</p>
  169. <p>ExFatLogger - A data-logger optimized for exFAT features.</p>
  170. <p>ExFatUnicodeTest - Test program for Unicode file names.</p>
  171. <p>OpenNext - Open all files in the root dir and print their filename.</p>
  172. <p>ReadCsvFile - Function to read a CSV text file one field at a time.</p>
  173. <p>RtcTimestampTest - Demonstration of timestamps with RTClib.</p>
  174. <p>SdErrorCodes - Produce a list of error codes.</p>
  175. <p>SdFormatter - This program will format an SD, SDHC, or SDXC card.</p>
  176. <p>SdInfo - Initialize an SD card and analyze its structure for trouble shooting.</p>
  177. <p>SoftwareSpi - Demo of limited Software SPI support in SdFat V2.</p>
  178. <p>STM32Test - Example use of two SPI ports on an STM32 board.</p>
  179. <p>TeensyRtcTimestamp - File timestamps for Teensy3.</p>
  180. <p>TeensySdioDemo - Demo of SDIO and SPI modes for the Teensy 3.5/3.6 built-in SD. </p>
  181. </div></div><!-- contents -->
  182. <!-- start footer part -->
  183. <hr class="footer"/><address class="footer"><small>
  184. Generated on Thu May 9 2019 06:51:29 for SdFat by &#160;<a href="http://www.doxygen.org/index.html">
  185. <img class="footer" src="doxygen.png" alt="doxygen"/>
  186. </a> 1.8.14
  187. </small></address>
  188. </body>
  189. </html>