{"id":3532,"date":"2016-08-31T02:58:47","date_gmt":"2016-08-31T02:58:47","guid":{"rendered":"http:\/\/41j.com\/blog\/?p=3532"},"modified":"2016-08-31T02:58:47","modified_gmt":"2016-08-31T02:58:47","slug":"the-esp8266-and-sd-cards","status":"publish","type":"post","link":"https:\/\/41j.com\/blog\/2016\/08\/the-esp8266-and-sd-cards\/","title":{"rendered":"The esp8266 and SD Cards"},"content":{"rendered":"<p><a href=\"http:\/\/41j.com\/blog\/2016\/08\/the-esp8266-and-sd-cards\/espusb1\/\" rel=\"attachment wp-att-3533\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3533 aligncenter\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2016\/08\/espusb1.jpg\" alt=\"espusb1\" width=\"341\" height=\"116\" \/><\/a><a href=\"http:\/\/41j.com\/blog\/2016\/08\/the-esp8266-and-sd-cards\/espusb2\/\" rel=\"attachment wp-att-3534\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3534 alignright\" src=\"http:\/\/41j.com\/blog\/wp-content\/uploads\/2016\/08\/espusb2.jpg\" alt=\"espusb2\" width=\"290\" height=\"218\" \/><\/a>Recently I&#8217;ve been using the esp8266 with SD cards in order to develop the small board shown above and to the right. It hosts a CH340g USB interface, small buck converter to supply 3.3v to the esp8266 and an SD card slot.<\/p>\n<p>The esp8266 is pretty thin, and doesn&#8217;t really give the information necessary to get up and running, so it took some research and hacking around to get everything working.<\/p>\n<p>A lot of this was motivated by <a href=\"http:\/\/www.esp8266.com\/viewtopic.php?f=32&amp;t=3558\">this forum thread<\/a> which provided that it was possible to get SD cards working on the esp8266 using the SPI interface. SD cards generally use a more complex protocol and multiple data lines, but they can fall back to SPI mode (albeit with reduced performance).<\/p>\n<p>The <a href=\"https:\/\/github.com\/esp8266\/Arduino\">Arduino esp8266 support pack<\/a> also has done great work, and after configuring a chip select pin, the SD card library supplied there pretty much just works.<\/p>\n<p>I wanted to use the native esp8266 SDK without the Arduino environment. This took some hacking, but so far I&#8217;ve extracted the SD card library and have it up and running using a <a href=\"http:\/\/41j.com\/blog\/2016\/08\/esp8266-spi-duplex-transfers\/\">native SPI driver<\/a>, the main issue was enabling (the again undocumented) duplex mode of the esp8266 SPI interface. If you&#8217;d like a copy of this code ping me.<\/p>\n<p>One final note, some documents refer to &#8220;SD Card&#8221; boot mode. That would be really cool, to be able to load your firmware directly from an SD Card. Unfortunately it&#8217;s a bit of a misnomer. &#8220;SD Card&#8221; mode actually refers to SDIO mode. We don&#8217;t really hear much about SDIO anymore, but you used to be able to buy these <a href=\"http:\/\/www.geek.com\/review\/mini-review-sandisk-connect-sd-wi-fi-card-551230\/\">funky Wifi cards<\/a> which plugged into SD card slots. Other peripherals, like cameras were available too. You can read more about it on the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Secure_Digital#SDIO\">wikipedia page<\/a>.<\/p>\n<p>The esp8266 supports an SDIO boot mode. My guess is that this is a hang over from its heritage as a general purpose Wifi interface chip. Some people have used this functionality to <a href=\"https:\/\/hackaday.io\/project\/8678-rpi-wifi\">enable firmware loading over SPI<\/a>. It&#8217;s neat, but unfortunately doesn&#8217;t mean you can boot from a standard flash SD card.<\/p>\n<p>PLUG: I&#8217;m now selling the esp8266 SD card board above <a href=\"http:\/\/www.whitefordresearch.com\/products\/espusb-esp8266-usb-sd-card-interface-preorder\">on my shop<\/a>. My hope is to eventually progress this toward a consumer product which runs an access point and provides basic collaboration tools.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently I&#8217;ve been using the esp8266 with SD cards in order to develop the small board shown above and to the right. It hosts a CH340g USB interface, small buck converter to supply 3.3v to the esp8266 and an SD card slot. The esp8266 is pretty thin, and doesn&#8217;t really give the information necessary to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","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":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-3532","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1RRoU-UY","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/3532","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/comments?post=3532"}],"version-history":[{"count":2,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/3532\/revisions"}],"predecessor-version":[{"id":3536,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/posts\/3532\/revisions\/3536"}],"wp:attachment":[{"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/media?parent=3532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/categories?post=3532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/41j.com\/blog\/wp-json\/wp\/v2\/tags?post=3532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}