{"id":3793,"date":"2014-09-22T17:56:36","date_gmt":"2014-09-23T00:56:36","guid":{"rendered":"http:\/\/www.corbinstreehouse.com\/blog\/2014\/09\/sd-card-errors-with-arduino-teensy-3-0\/"},"modified":"2018-11-03T13:43:32","modified_gmt":"2018-11-03T20:43:32","slug":"sd-card-errors-with-arduino-teensy-3-0","status":"publish","type":"post","link":"https:\/\/www.corbinstreehouse.com\/blog\/2014\/09\/sd-card-errors-with-arduino-teensy-3-0\/","title":{"rendered":"SD Card errors with Arduino \/ Teensy 3.0"},"content":{"rendered":"<p id=\"top\" \/>\n<p>With my LED cyr wheel I kept getting random errors in reading data from my SD card with Ardunio code. Sometimes init would fail, even at half speed. Most often I would get corrupted data, or not be able to read the filenames. Worse, it would start to read and then fail. Searching around, I found it could be one of the following problems:<\/p>\n<p>* Bad SD card (I tried a few of them)<br \/>\n* Improperly formatted SD Card (I used the official SD Card Formatter from SD: <a href=\"https:\/\/www.sdcard.org\/downloads\/formatter_4\/\">https:\/\/www.sdcard.org\/downloads\/formatter_4\/<\/a> and it still failed)<br \/>\n* Floating CS (Chip Select \/ Slave Select) pin. I made sure I had the Chip Select pin was correct, and it was. This can be set to anything you want as long as it is wired properly and passed to the initializers.<br \/>\n* Incorrect voltage for the SD Card; it needs 3.3v. Now\u2026long story short: this was the problem, but I thought it wasn\u2019t because the <a href=\"https:\/\/www.pjrc.com\/teensy\/sd_adaptor.html\">SD Card Adapter<\/a> from PJRC has an onboard voltage regulator.<\/p>\n<p>I poked through the SdFat library quite a bit adding in debug logs and couldn\u2019t figure it out.<\/p>\n<p>Finally, I poked at the voltage that the SD Card Adapter was reading; it had a 5v input and the regulator was outputting about about 3.0something volts. I thought this was okay\u2026but later I came back to it, and wired the 3.3v directly from the teensy output to it. Then stuff started working!<\/p>\n<p>So: be warned. The PJRC Teensy SD Card Adapter needs a separate 3.3v input (and solder together the 3v joint). The onboard regulator doesn\u2019t work well enough!<\/p>\n<p>UPDATE: I\u2019m not 100% confident this was the problem. Dealing with the SD card has been a nightmare due to read errors and inconsistency. I could reproduce the corrupt data problem on my breadboard and with my physical hardware, which is why I felt like the voltage was the problem. However, in my LED wheel I still had issues, and it seemed to be due to wire length and size. I\u2019m now using 22 gauge wires with shielding, and slightly shorter. It seems to work so far.<\/p>\n<p>UPDATE 2: Maybe I am just an idiot; after re-wiring a bunch, I realized what CS pin I thought I was using may not have been right! That may have been my problem all along..<\/p>\n","protected":false},"excerpt":{"rendered":"<p>With my LED cyr wheel I kept getting random errors in reading data from my SD card with Ardunio code. Sometimes init would fail, even at half speed. Most often I would get corrupted data,&#8230; <a class=\"read-more\" href=\"https:\/\/www.corbinstreehouse.com\/blog\/2014\/09\/sd-card-errors-with-arduino-teensy-3-0\/\">[read more]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[86,1],"tags":[126,129,72],"class_list":["post-3793","post","type-post","status-publish","format-standard","hentry","category-coding","category-general","tag-arduino","tag-c","tag-programming"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/3793","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/comments?post=3793"}],"version-history":[{"count":3,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/3793\/revisions"}],"predecessor-version":[{"id":5366,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/posts\/3793\/revisions\/5366"}],"wp:attachment":[{"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/media?parent=3793"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/categories?post=3793"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.corbinstreehouse.com\/blog\/wp-json\/wp\/v2\/tags?post=3793"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}