<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=""><div class=""><br class=""></div>For those of you who’ve hit RAM limits, does this interest you?<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (707) cpu_start: PSRAM mode: flash 40m sram 40m</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (721) cpu_start: PSRAM initialized, cache is in even/odd (2-core) mode.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3512) heap_alloc_caps: SPI SRAM memory test OK</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3513) heap_alloc_caps: Initializing. RAM available for dynamic allocation:</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3518) heap_alloc_caps: At 3F800000 len 00400000 (4096 KiB): SPIRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3540) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3561) heap_alloc_caps: At 3FFB2378 len 0000DC88 (55 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3582) heap_alloc_caps: At 3FFC0000 len 00008000 (32 KiB): DMAONLY</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3603) heap_alloc_caps: At 3FFC8000 len 00018000 (96 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3624) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3646) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (3667) heap_alloc_caps: At 40089434 len 00016BCC (90 KiB): IRAM</span></font></div></div></blockquote><div class=""><br class=""></div><div class="">A normal ESP32 looks like this:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (777) heap_alloc_caps: Initializing. RAM available for dynamic allocation:</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (799) heap_alloc_caps: At 3FFAE2A0 len 00001D60 (7 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (819) heap_alloc_caps: At 3FFB23E0 len 0002DC20 (183 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (840) heap_alloc_caps: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (861) heap_alloc_caps: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 14px;" class="">I (882) heap_alloc_caps: At 400874D0 len 00018B30 (98 KiB): IRAM</span></font></div></blockquote><div class=""><br class=""></div><div class="">Note: Some differences caused by ESP IDF v2.1 vs v3.x.</div><div class=""><br class=""></div><div class="">There are still lots of restrictions (such as stacks only being in internal RAM unless the task doesn’t use wifi, bluetooth, rom routines, etc). But, for things like CAN bus RE, logging, etc, it could be pretty useful. Now, on to wire-up a SD CARD and see if it works. Should know in a few hours...</div><div class=""><br class=""></div><div class="">Regards, Mark</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 23 Nov 2017, at 1:50 PM, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" class="">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">An update on SD card issues.<div class=""><br class=""></div><div class="">We’ve (finally) narrowed down the problem. It seems our wiring is fine, pull-ups are fine, and software is as expected. No problem with interference, or power supply.</div><div class=""><br class=""></div><div class="">The issue seems to be a conflict in the ESP IDF (probably bootloader, or ESP hardware) when using our external 16MB flash. Flash memory in the ESP32 is controlled over an SPI bus. We use the same SPI bus pins as the standard on-board flash, but a different CS (Chip Select) line (GPIO22 vs SD3 pin #19 for the standard 4MB flash chip). We burn fuses to tell the ESP32 to use our flash CS line (rather than the built-in one). That’s it. Nothing special, and no pin conflicts. We think some other conflict between the SD CARD and SPI hardware in the ESP-32 chip (perhaps requiring special handling in the bootloader / library code).</div><div class=""><br class=""></div><div class="">Now, when OVMS is using this external flash, and accessing SD CARD, it becomes unreliable. It may seem fine, but read/write a lot and it fails. Replace the WROOM-32 module with one without efuses burnt (using internal 4MB flash), and the SD CARD goes back to working normally.</div><div class=""><br class=""></div><div class="">I’ve finally (god, this has been frustrating) got someone at Espressif to recognise the problem and they are trying to re-create. The solution may be resolvable in bootloader code (best case), or may require a hardware fix. Whichever, we are close.</div><div class=""><br class=""></div><div class="">While researching workarounds, and bearing in mind the latest ESP32 WROVER modules offering external PSRAM (SPI RAM; to expand RAM space in a similar way to external flash expands code space), I found a company called <a href="https://www.analoglamb.com/product/alb32-wrover-esp32-module-with-64mb-flash-and-32mb-psram/" class="">AnalogLamb</a>  These guys make a pin-compatible WROOM32 module including different size FLASH and PSRAM chips. We can get a module with 16MB flash and 4MB PSRAM - giving us the flash space we need, and another 4MB of heap space in RAM. It is not quite a drop-in replacement, as GPIO16+17 are used for the PSRAM (so we would have to move the GPIOs used for our modem), and the PSRAM requires the latest ESP IDF version (which brings other issues with it), but it seems to be a workable solution. I’ve gotten a hold of two sample modules (just arrived today) and will be trying them tonight. I’ll let you know how it works out.</div><div class=""><br class=""></div><div class="">Regards, Mark.</div><div class=""><br class=""></div><div class=""><span id="cid:E949C0A9-13A1-406B-BF34-99623AEB71BC"><IMG_5655.jpeg></span><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 7 Nov 2017, at 9:11 PM, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" class="">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Edward, Steve: thanks for your feedback.<div class=""><br class=""></div><div class="">I made some progress. It turns out that the stuck-in-download-mode-after-flashing issue is caused by the SD CARD itself (not GPIO0 as I had thought). If I flash with the SD CARD inserted, I get that issue. If I remove the SD CARD, then reset, the module boots fine. I can then re-insert the SD CARD and everything is fine until next time I flash.</div><div class=""><br class=""></div><div class="">So, something in the SD CARD itself is pulling down GPIO2, after flashing. That is D0, and very bizarre.</div><div class=""><br class=""></div><div class="">However, I think that is a workable compromise; we can’t flash with an SD CARD inserted.</div><div class=""><br class=""></div><div class="">I guess I can play around with the pull-up resistor size on D0 to see if I can improve on this, but I’m willing to live with that compromise.</div><div class=""><br class=""></div><div class="">So, it is working now on breadboard in 1 line mode.</div><div class=""><br class=""></div><div class="">I’m now going to move on to trying to get it to work with our external SPI flash arrangement, and 1 line mode. I have a breadboard already setup for that - just some re-wiring to be done.</div><div class=""><br class=""></div><div class="">If that works, I’ll try 4 line mode.</div><div class=""><br class=""></div><div class="">Onwards…</div><div class=""><br class=""></div><div class="">Mark.</div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 6 Nov 2017, at 1:27 PM, Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" class="">mark@webb-johnson.net</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Some more notes on this:<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class="">Back to basics. I made a simple breadboard using standard Espressif code (attached) and a Geikcreit development board.<div class=""><br class=""></div><div class="">Wiring is GPIO14 -> CLK, GPIO15->CMD, CPIO2->D0, GPIO0->GPIO2 link, GND and 3.3V. 10K Pullups on CLK, CMD, D0 and D3. Software is set to 1bit SD mode.</div><div class=""><br class=""></div><div class="">If I plug-in USB power, start monitor terminal, all works perfectly:</div><div class=""><br class=""></div><blockquote class="" style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class=""><div class=""><font face="Andale Mono" class="">I (276) example: Initializing SD card</font></div><div class=""><font face="Andale Mono" class="">I (276) example: Using SDMMC peripheral</font></div><div class=""><font face="Andale Mono" class="">Name: SC16G</font></div><div class=""><font face="Andale Mono" class="">Type: SDHC/SDXC</font></div><div class=""><font face="Andale Mono" class="">Speed: default speed</font></div><div class=""><font face="Andale Mono" class="">Size: 15193MB</font></div><div class=""><font face="Andale Mono" class="">CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9</font></div><div class=""><font face="Andale Mono" class="">SCR: sd_spec=2, bus_width=5</font></div><div class=""><font face="Andale Mono" class="">I (356) example: Opening file</font></div><div class=""><font face="Andale Mono" class="">I (366) example: File written</font></div><div class=""><font face="Andale Mono" class="">I (376) example: Renaming file</font></div><div class=""><font face="Andale Mono" class="">I (376) example: Reading file</font></div><div class=""><font face="Andale Mono" class="">I (376) example: Read from file: 'Hello SC16G!'</font></div><div class=""><font face="Andale Mono" class="">I (376) example: SD CARD test starts...</font></div><div class=""><font face="Andale Mono" class="">I (386) example: SD CARD written 0/2048</font></div><div class=""><font face="Andale Mono" class="">I (526) example: SD CARD written 128/2048</font></div><div class=""><font face="Andale Mono" class="">I (676) example: SD CARD written 256/2048</font></div><div class=""><font face="Andale Mono" class="">I (816) example: SD CARD written 384/2048</font></div><div class=""><font face="Andale Mono" class="">I (956) example: SD CARD written 512/2048</font></div><div class=""><font face="Andale Mono" class="">I (1106) example: SD CARD written 640/2048</font></div><div class=""><font face="Andale Mono" class="">I (1246) example: SD CARD written 768/2048</font></div><div class=""><font face="Andale Mono" class="">I (1386) example: SD CARD written 896/2048</font></div><div class=""><font face="Andale Mono" class="">I (1526) example: SD CARD written 1024/2048</font></div><div class=""><font face="Andale Mono" class="">I (1676) example: SD CARD written 1152/2048</font></div><div class=""><font face="Andale Mono" class="">I (1816) example: SD CARD written 1280/2048</font></div><div class=""><font face="Andale Mono" class="">I (1966) example: SD CARD written 1408/2048</font></div><div class=""><font face="Andale Mono" class="">I (2106) example: SD CARD written 1536/2048</font></div><div class=""><font face="Andale Mono" class="">I (2246) example: SD CARD written 1664/2048</font></div><div class=""><font face="Andale Mono" class="">I (2396) example: SD CARD written 1792/2048</font></div><div class=""><font face="Andale Mono" class="">I (2546) example: SD CARD written 1920/2048</font></div><div class=""><font face="Andale Mono" class="">I (2686) example: Cleaning up</font></div><div class=""><font face="Andale Mono" class="">I (2696) example: Card unmounted</font></div></div></blockquote><div class=""><br class=""></div><div class="">In that case, GPIO0/GPIO2 has 2.567v. Pressing BOOT key brings GPIO0/GPIO2 to 0v, and back to 2.567v when release the button. During SDCARD test, GPIO0/GPIO2 is at around 0.682v.</div><div class=""><br class=""></div><div class="">With monitor connected, if I flash, GPIO0/GPIO2 is 0.323v. Screen says:</div><div class=""><br class=""></div><blockquote class="" style="margin: 0px 0px 0px 40px; border: none; padding: 0px;"><div class=""><div class=""><font face="Andale Mono" class="">rst:0x1 (POWERON_RESET),boot:0x3 (DOWNLOAD_BOOT(UART0/UART1/SDIO_REI_REO_V2))</font></div><div class=""><font face="Andale Mono" class="">waiting for download</font></div></div></blockquote><div class=""><br class=""></div><div class="">Pressing boot key goes to 0v, then releasing it goes back to 0.323v.</div><div class=""><br class=""></div><div class="">Pressing RESET key, no change. Stuck.</div><div class=""><br class=""></div><div class="">Disconnecting terminal monitor, no change. Stuck.</div><div class=""><br class=""></div><div class="">Reconnecting terminal monitor, no change. Stuck.</div><div class=""><br class=""></div><div class="">Removed link between GPIO0 and GPIO2. Now GPIO0 measures 3.3v and GPIO2 measures 0v.</div><div class=""><br class=""></div><div class="">Reconnection link between GPIO0 and GPIO2. Now GPIO0/GPIO2 measures 3.3v, boot ok, and SDCARD test runs ok.</div><div class=""><br class=""></div><div class="">So, it seems the transistor reset circuitry is not working correctly. I have tried asking on the <a href="http://esp32.com/" class="">esp32.com</a> forums, but nobody answering.</div></div></blockquote><div class=""><div class=""><br class=""></div><div class="">Any ideas?</div><div class=""><br class=""></div><div class="">Regards, Mark.</div><div class=""><br class=""><blockquote type="cite" class=""><div class="">Begin forwarded message:</div><br class="Apple-interchange-newline"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b class="">From: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">Mark Webb-Johnson <<a href="mailto:mark@webb-johnson.net" class="">mark@webb-johnson.net</a>><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b class="">Subject: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class=""><b class="">SD CARD</b><br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><span style="font-family: -webkit-system-font, 'Helvetica Neue', Helvetica, sans-serif;" class=""><b class="">Date: </b></span><span style="font-family: -webkit-system-font, Helvetica Neue, Helvetica, sans-serif;" class="">26 October 2017 at 10:26:01 PM HKT<br class=""></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px;" class=""><br class=""></div><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Any electronics guys out there can help out with SD CARD? It is frustrating as hell. The last part of the hardware puzzle. Once we solve this, we can hit the button to start making these. China and I have been struggling with this for the last month, with little progress.</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">We are just following the standard Espressif schematics for this. Here is Espressif’s master document on it:</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" 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></blockquote><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Our circuit has been built for 4 wire SD mode, using the standard pins and pullups (as documented by Espressif). Result is that it is unreliable. Fails to mount 90% of SD CARDS, and those that do mount fail and corrupt data when writing lots of data out.</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">The core problem (we think) is that the GPIO2 and GPIO12 pins used for SD CARD are also required to be at specific values during boot (to select different boot modes). Espressif suggest to work around this using the transistor logic they have for controlling boot mode pins using the USB-to-serial converter and DTR + RTS async control pins.</div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""></div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">We want 4-wire, but let’s start with a simple 1-wire diagram on a breadboard (as per Espressif instructions):</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><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=""><b class="">GPIO14</b> (MTMS)</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class=""><b class="">CLK</b></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=""><b class="">10k pullup</b> 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=""><b class="">GPIO15</b> (MTDO)</td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class=""><b class="">CMD</b></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=""><b class="">10k pullup</b>, 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=""><b class="">GPIO2</b></td><td style="box-sizing: border-box; padding: 6px 13px; border: 1px solid rgb(223, 226, 229);" class=""><b class="">D0</b></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=""><b class="">10k pullup in SD mode, pull low to go into download mode (see note below!)</b></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=""><b class="">D3</b></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 <b class="">10k pullup</b></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><br class=""></div><div class="">Also:</div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#24292e" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class="">Connect GPIO0 and GPIO2 using a jumper (so transistors drive GPIO2 and GPIO0 low when entering download mode (10K pullup otherwise)</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#24292e" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class="">3.3V connect to SDCARD</font></span></div><div class=""><span style="background-color: rgb(255, 255, 255);" class=""><font color="#24292e" face="-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3" class="">GND connect to SDCARD</font></span></div></blockquote><div class=""><br class=""></div><div class="">We have a variety of ESP32 development modules to try this with. Espressif said that the original DEVKIT C had a problem with the boot pin control lines and transistor logic (but never said what exactly that problem was).</div><div class=""><br class=""></div><div class="">With original (old) ESP32 DEVKIT C, I can’t get it to work reliably at all. Sometimes ok. Sometimes not. With OVMS test code (that writes a lot of data), it never works.</div><div class=""><br class=""></div><div class="">With our OVMS boards, all versions, I can’t get it to work reliably at all. Sometimes ok. Sometimes not. With OVMS test code (that writes a lot of data), it never works.</div><div class=""><br class=""></div><div class="">I don’t think it ever worked. Just before our test was so simple that it didn’t show the problem.</div><div class=""><br class=""></div><div class="">So, I just purchased one of these:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://www.banggood.com/ESP32-Development-Board-WiFiBluetooth-Ultra-Low-Power-Consumption-Dual-Cores-ESP-32-ESP-32S-Board-p-1109512.html" class="">https://www.banggood.com/ESP32-Development-Board-WiFiBluetooth-Ultra-Low-Power-Consumption-Dual-Cores-ESP-32-ESP-32S-Board-p-1109512.html</a></div><div class=""><br class=""></div><div class=""><h1 itemprop="name" class="" style="padding: 0px; margin: 0px; font-size: 16px; line-height: 1.5; color: rgb(51, 51, 51); font-family: Arial; background-color: rgb(249, 249, 249);">Geekcreit® ESP32 Development Board WiFi+Bluetooth Ultra Low Power Consumption Dual Cores ESP-32 ESP-32S Board</h1><div class=""><br class=""></div></div><div class="">(Very similar to DEVKIT C, but more modern)</div></blockquote><div class=""><br class=""></div><div class="">It works 100%. Although after flashing it cannot boot (waiting for download) - need to disconnect GPIO0 - GPIO2 link, reset, then reconnect GPIO0-GPIO2 link. Then perfect.</div><div class=""><br class=""></div><div class="">I think our problem is related to that transistor auto-flash reset circuitry. GPIO2 is the line for data transfer, so if problem will cause data corruption and unreliable (like we are seeing).</div><div class=""><br class=""></div><div class="">Espressif SD CARD notes here:</div><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></blockquote><div class=""><br class=""></div><div class="">Schematic for Geekcreit board is here:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0" class="">https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0</a></div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div><div class=""><span id="cid:BB1BAF91-49B9-4C9D-98C7-EBFE25961A95" class=""><PastedGraphic-4.tiff></span></div></blockquote><div class=""><br class=""></div><div class="">Schematic for latest version of Espressif DEVKIT C board is here:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><font class=""><a href="http://espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf" class="">http://espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf</a></font></div></blockquote><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><br class=""></div><div class=""><span id="cid:B877B268-3D5B-4387-A8C4-2FF4A2B5145D" class=""><PastedGraphic-5.tiff></span></div></blockquote><div class=""><br class=""></div><div class="">The original DEVKIT C (v1) had 1K resistors on that circuit. This is the version I have.</div><div class=""><br class=""></div><div class="">The Geekcreit has 10K resistors on that circuit.</div><div class=""><br class=""></div><div class="">OVMS has 10K resistors on that circuit.</div><div class=""><br class=""></div><div class="">The latest DEVKIT C (v3) has 12K resistors on that circuit.</div><div class=""><br class=""></div><div class="">DEVKIT C v1 schematic is here: <a href="http://dl.espressif.com/dl/schematics/ESP32-DevKitJ-v1_sch.pdf" class="">http://dl.espressif.com/dl/schematics/ESP32-DevKitJ-v1_sch.pdf</a></div><div class="">DEVKIT C v2 schematic is here: <a href="http://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf" class="">http://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf</a></div><div class=""><br class=""></div><div class="">The latest Espressif ROVER KIT development board schematic is here:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><a href="https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-3.pdf" class="">https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-3.pdf</a></div><div class=""><br class=""></div><div class=""><span id="cid:A0B71647-071F-42E7-840C-852F37074F8C" class=""><PastedGraphic-6.tiff></span></div><div class=""><br class=""></div><div class=""><span id="cid:B881A4D2-1904-4E9A-A0F3-7C744DF25F66" class=""><PastedGraphic-7.tiff></span></div></blockquote><div class=""><br class=""></div><div class="">Note that they are now using 100K resistors, and a separate transistor on IO0 (to allow it to be independently controlled after boot).</div><div class=""><br class=""></div><div class="">I am reasonably certain our SD CARD problem concerns the GPIO0-GPIO2 link.</div><div class=""><br class=""></div><div class="">Can you look at these, and see if you can find the difference? Apart from resistor sizes (which Espressif keep messing around with), I can’t see the practical difference.</div><div class=""><br class=""></div><div class="">Regards, Mark.</div></div></div></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.teslaclub.hk" class="">OvmsDev@lists.teslaclub.hk</a><br class=""><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" class="">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br class=""></div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">OvmsDev mailing list<br class=""><a href="mailto:OvmsDev@lists.teslaclub.hk" class="">OvmsDev@lists.teslaclub.hk</a><br class=""><a href="http://lists.teslaclub.hk/mailman/listinfo/ovmsdev" class="">http://lists.teslaclub.hk/mailman/listinfo/ovmsdev</a><br class=""></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>