<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">We’re using the circuit design from Espressif.<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card" class="">https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card</a></div><div class=""><br class=""></div><div class=""><table style="box-sizing: border-box; border-spacing: 0px; border-collapse: collapse; margin-top: 0px; margin-bottom: 16px; display: block; width: 888px; overflow: auto; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><thead style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box; border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><th style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">ESP32 pin</th><th style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">SD card pin</th><th style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">SPI pin</th><th style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">Notes</th></tr></thead><tbody style="box-sizing: border-box;" class=""><tr style="box-sizing: border-box; border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">GPIO14 (MTMS)</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">CLK</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">SCK</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">10k pullup in SD mode</td></tr><tr style="box-sizing: border-box; background-color: rgb(246, 248, 250); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">GPIO15 (MTDO)</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">CMD</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">MOSI</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">10k pullup, both in SD and SPI modes</td></tr><tr style="box-sizing: border-box; border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">GPIO2</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">D0</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">MISO</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">10k pullup in SD mode, pull low to go into download mode (see note below!)</td></tr><tr style="box-sizing: border-box; background-color: rgb(246, 248, 250); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">GPIO4</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">D1</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">N/C</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">not used in 1-line SD mode; 10k pullup in 4-line SD mode</td></tr><tr style="box-sizing: border-box; border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">GPIO12 (MTDI)</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">D2</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">N/C</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">not used in 1-line SD mode; 10k pullup in 4-line SD mode (see note below!)</td></tr><tr style="box-sizing: border-box; background-color: rgb(246, 248, 250); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">GPIO13 (MTCK)</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">D3</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">CS</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">not used in 1-line SD mode, but card's D3 pin must have a 10k pullup</td></tr><tr style="box-sizing: border-box; border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">N/C</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">CD</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class=""></td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">optional, not used in the example</td></tr><tr style="box-sizing: border-box; background-color: rgb(246, 248, 250); border-top-width: 1px; border-top-style: solid; border-top-color: rgb(198, 203, 209);" class=""><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">N/C</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">WP</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class=""></td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class="">optional, not used in the example</td></tr></tbody></table><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">This example doesn't utilize card detect (CD) and write protect (WP) signals from SD card slot.</p><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">With the given pinout for SPI mode, same connections between the SD card and ESP32 can be used to test both SD and SPI modes, provided that the appropriate pullups are in place. In SPI mode, pins can be customized. See the initialization of <code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(27, 31, 35, 0.0470588); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">sdspi_slot_config_t</code> structure in the example code.</p><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-note-about-gpio2" class="anchor" href="https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#note-about-gpio2" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(3, 102, 214); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Note about GPIO2</h3><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">GPIO2 pin is used as a bootstrapping pin, and should be low to enter UART download mode. One way to do this is to connect GPIO0 and GPIO2 using a jumper, and then the auto-reset circuit on most development boards will pull GPIO2 low along with GPIO0, when entering download mode.</p><h3 style="box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; background-color: rgb(255, 255, 255);" class=""><a id="user-content-note-about-gpio12" class="anchor" href="https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card#note-about-gpio12" aria-hidden="true" style="box-sizing: border-box; background-color: transparent; -webkit-text-decoration-skip: objects; color: rgb(3, 102, 214); text-decoration: none; float: left; padding-right: 4px; margin-left: -20px; line-height: 1;"><svg aria-hidden="true" class="octicon octicon-link" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Note about GPIO12</h3><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">GPIO12 is used as a bootstrapping pin to select output voltage of an internal regulator which powers the flash chip (VDD_SDIO). This pin has an internal pulldown so if left unconnected it will read low at reset (selecting default 3.3V operation). When adding a pullup to this pin for SD card operation, consider the following:</p><ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class=""><li style="box-sizing: border-box;" class="">For boards which don't use the internal regulator (VDD_SDIO) to power the flash, GPIO12 can be pulled high.</li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">For boards which use 1.8V flash chip, GPIO12 needs to be pulled high at reset. This is fully compatible with SD card operation.</li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">On boards which use the internal regulator and a 3.3V flash chip, GPIO12 must be low at reset. This is incompatible with SD card operation.<ul style="box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 0px;" class=""><li style="box-sizing: border-box;" class="">In most cases, external pullup can be omitted and an internal pullup can be enabled using a <code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(27, 31, 35, 0.0470588); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">gpio_pullup_en(GPIO_NUM_12);</code> call. Most SD cards work fine when an internal pullup on GPIO12 line is enabled. Note that if ESP32 experiences a power-on reset while the SD card is sending data, high level on GPIO12 can be latched into the bootstrapping register, and ESP32 will enter a boot loop until external reset with correct GPIO12 level is applied.</li><li style="box-sizing: border-box; margin-top: 0.25em;" class="">Another option is to burn the flash voltage selection efuses. This will permanently select 3.3V output voltage for the internal regulator, and GPIO12 will not be used as a bootstrapping pin. Then it is safe to connect a pullup resistor to GPIO12. This option is suggested for production use.</li></ul></li></ul><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">The following command can be used to program flash voltage selection efuses <span style="box-sizing: border-box; font-weight: 600;" class="">to 3.3V</span>:</p><div class="highlight highlight-source-shell" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);"><pre style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(246, 248, 250); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-break: normal;" class="">    components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V</pre></div><p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; background-color: rgb(255, 255, 255);" class="">This command will burn the <code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(27, 31, 35, 0.0470588); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">XPD_SDIO_TIEH</code>, <code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(27, 31, 35, 0.0470588); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">XPD_SDIO_FORCE</code>, and <code style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace; font-size: 13.600000381469727px; padding: 0.2em 0px; margin: 0px; background-color: rgba(27, 31, 35, 0.0470588); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">XPD_SDIO_REG</code> efuses. With all three burned to value 1, the internal VDD_SDIO flash voltage regulator is permanently enabled at 3.3V. See the technical reference manual for more details.</p></div></blockquote><div class=""><div class="">Only difference is we have a card detect pin wired as well.</div><div class=""><br class=""></div><div class="">No filter and stabilisation caps on the SD CARD side, but we do have on the main power supply.</div><div class=""><br class=""></div><div class="">I have a breadboard version of OVMS v3 (using a standard SD card adaptor) that used to work fine, but is now suffering from the same problem. I just doesn’t seem to work at all since we switched to IDF v2.1 I suspect it is the esp-32 IDF libraries - there has been some recent re-working (in bleeding head) of the SPI libraries, and reports of similar issues. Even if I compile the standard espressif sd card example code, I can’t get it to work now (either on breadboard, or real OVMS v3 hardware).</div><div class=""><br class=""></div><div class="">The strange thing is that the China side are reporting no issues.</div><div class="">'</div><div class="">Regards, Mark.</div><div class=""><br class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On 5 Oct 2017, at 8:00 AM, <a href="mailto:mr23@comcast.net" class="">mr23@comcast.net</a> wrote:</div><br class="Apple-interchange-newline"><div class="">







<div style="margin-bottom:45px" class="">
    <div style="font-size: 10pt;" class=""><div dir="auto" class="">I don't have the circuit handy.</div><div dir="auto" class="">Does the sdcard chip and processor chip have filter caps and stabilization caps (for current draw surge)?</div></div><div style="font-size: 10pt;" class=""><div id="LGEmailHeader" dir="auto" class=""><div dir="auto" class=""><br class=""></div><div dir="auto" class="">------ Original message------</div><div dir="auto" class=""><b class="">From: </b>Stephen Casner<casner@acm.org class=""></casner@acm.org></div><div dir="auto" class=""><b class="">Date: </b>Wed, Oct 4, 2017 6:51 PM</div><div dir="auto" class=""><b class="">To: </b>OVMS Developers;</div><div dir="auto" class=""><b class="">Cc: </b></div><div dir="auto" class=""><b class="">Subject:</b>Re: [Ovmsdev] OVMS v3 getting started</div><div dir="auto" class=""><br class=""></div></div><pre class="">On Mon, 25 Sep 2017, Mark Webb-Johnson wrote:

> I’m having problems getting SD CARDs to work reliably. Some work
> recognise at all (a timeout error when mounting), and some will
> recognise but fail under heavy writes to the sd card. Frustrating as
> hell. I don’t think it is a hardware issue (even the googling that
> error message points to pull-up resistors as the culprit), but
> suspect some issue with the ESP IDF 2.1 library we are using. We’re
> working on this one at the moment. I would appreciate your feedback,
> when you get the boards, as to whether you get any success with SD
> CARDs.

I have a SanDisk Ultra 32GB micro SD card left over from playing with
a Raspberry Pi.  It is formatted FAT32 with name RECOVERY.  When I
insert it into the OVMS v3 and try the sd mount command, I get:

OVMS > sd mount
Error: SD CARD could not be mounted
E (75093) sdmmc_cmd: sdmmc_card_init: send_scr returned 0x107

                                                        -- Steve
_______________________________________________
OvmsDev mailing list<a href="mailto:OvmsDev@lists.teslaclub.hk" class="">
OvmsDev@lists.teslaclub.hk</a>
<a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" class="">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a>
</pre></div>


</div>_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.teslaclub.hk" class="">OvmsDev@lists.teslaclub.hk</a><br class="">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev<br class=""></div></blockquote></div><br class=""></div></div></body></html>