<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><div class=""><br class=""></div><div class="">Using Espressif standard SD CARD example program, modified to write "Hello\n” 10 million times, and then read it back 10 million times...</div><div class=""><br class=""></div><div class="">Here is what I get with OVMS v3 developer-release hardware using release version of ESP IDF v2.1:</div><div class=""><br class=""></div><blockquote style="margin: 0px 0px 0px 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><span style="font-size: 18px; font-family: "Andale Mono";" class="">I (50) boot: ESP-IDF v2.1.1-8-g5ae2c0d0 2nd stage bootloader</span></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (51) boot: compile time 08:28:36</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (83) boot: Enabling RNG early entropy source...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (84) boot: SPI Speed : 40MHz</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (84) boot: SPI Mode : DIO</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (94) boot: SPI Flash Size : 16MB</span></font></div></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">…</span></font></div><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (910) cpu_start: Pro cpu start user code</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (967) cpu_start: Starting scheduler on PRO CPU.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (972) example: Initializing SD card</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (972) cpu_start: Starting scheduler on APP CPU.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">E (1112) sdmmc_cmd: sdmmc_card_init: send_scr returned 0x107</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">E (1112) example: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.</span></font></div></div></blockquote><div class=""></div></div><div class=""><br class=""></div><div class="">Using latest (bleeding edge, not released) ESP IDF v3.1, using 1 line mode:</div><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: 18px;" class="">I (31) boot: ESP-IDF v3.1-dev-168-ga1b59679 2nd stage bootloader</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (31) boot: compile time 08:35:38</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (42) boot: Enabling RNG early entropy source...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (42) boot: SPI Speed : 40MHz</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (42) boot: SPI Mode : DIO</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (45) boot: SPI Flash Size : 16MB</span></font></div></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">…</span></font></div><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (195) cpu_start: Pro cpu up.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (199) cpu_start: Starting app cpu, entry point is 0x40080e38</span></font></div><div class=""><span style="font-size: 18px; font-family: "Andale Mono";" class="">I (0) cpu_start: App cpu up.</span></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (209) heap_init: Initializing. RAM available for dynamic allocation:</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (216) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (222) heap_init: At 3FFB2A48 len 0002D5B8 (181 KiB): DRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (228) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (235) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (241) heap_init: At 40089270 len 00016D90 (91 KiB): IRAM</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (247) cpu_start: Pro cpu start user code</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (265) cpu_start: Starting scheduler on PRO CPU.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (0) cpu_start: Starting scheduler on APP CPU.</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (267) example: Initializing SD card</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (267) example: Using SDMMC peripheral</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Name: SB16G</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Type: SDHC/SDXC</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Speed: default speed</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Size: 15193MB</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">SCR: sd_spec=2, bus_width=5</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (347) example: Opening file</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (347) example: write count = 0 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (25397) example: write count = 1000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (50417) example: write count = 2000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (75737) example: write count = 3000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (101277) example: write count = 4000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (127417) example: write count = 5000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (154087) example: write count = 6000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (180247) example: write count = 7000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (206977) example: write count = 8000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (232807) example: write count = 9000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (259647) example: File written</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (259647) example: Renaming file</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (259657) example: Reading file</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (259657) example: read count = 0 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (278507) example: read count = 1000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (297367) example: read count = 2000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (316427) example: read count = 3000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (335347) example: read count = 4000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (354327) example: read count = 5000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (373157) example: read count = 6000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (391637) example: read count = 7000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (410097) example: read count = 8000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (428517) example: read count = 9000000 ...</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (446807) example: Read from file: 'Hello'</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (446807) example: Card unmounted</span></font></div></div></blockquote><div class=""><br class=""></div><div class="">and using v3.1 with 4-line mode:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">I (247) cpu_start: Pro cpu start user code<br class="">I (265) cpu_start: Starting scheduler on PRO CPU.<br class="">I (0) cpu_start: Starting scheduler on APP CPU.<br class="">I (267) example: Initializing SD card<br class="">I (267) example: Using SDMMC peripheral<br class="">Name: SB16G<br class="">Type: SDHC/SDXC<br class="">Speed: default speed<br class="">Size: 15193MB<br class="">CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9<br class="">SCR: sd_spec=2, bus_width=5<br class="">I (347) example: Opening file<br class="">I (357) example: write count = 0 ...<br class="">I (24187) example: write count = 1000000 ...<br class="">I (47637) example: write count = 2000000 ...<br class="">I (71277) example: write count = 3000000 ...<br class="">I (94927) example: write count = 4000000 ...<br class="">I (119567) example: write count = 5000000 ...<br class="">I (143517) example: write count = 6000000 ...<br class="">I (168297) example: write count = 7000000 ...<br class="">I (192597) example: write count = 8000000 ...<br class="">I (216847) example: write count = 9000000 ...<br class="">I (240587) example: File written<br class="">I (240727) example: Renaming file<br class="">I (240727) example: Reading file<br class="">I (240737) example: read count = 0 ...<br class="">I (257697) example: read count = 1000000 ...<br class="">I (274507) example: read count = 2000000 ...<br class="">I (291327) example: read count = 3000000 ...<br class="">I (308117) example: read count = 4000000 ...<br class="">I (325157) example: read count = 5000000 ...<br class="">I (341647) example: read count = 6000000 ...<br class="">I (358397) example: read count = 7000000 ...<br class="">I (375097) example: read count = 8000000 ...<br class="">I (391787) example: read count = 9000000 ...<br class="">I (408247) example: Read from file: 'Hello'<br class="">I (408247) example: Card unmounted</span></font></blockquote><div class=""><br class=""></div><div class="">Smiling so much my face hurts... This has been such a PITA, but it looks like Espressif have finally solved it with their latest pre-release SDK.</div><div class=""><br class=""></div><div class="">Very little performance difference between 1 line and 4 line modes (4 line is about 8% faster), so probably not worth using up those GPIO lines for that.</div><div class=""><br class=""></div><div class="">I’m working with Espressif to see if this fix can be back-ported to v2.1. I doubt it, but no harm asking…</div><div class=""><br class=""></div><div class=""><div class="">This all, of course, brings into top priority the work Steve and I are doing trying to get OVMS v3 firmware working against ESP IDF v3.x. Here’s a hastily hacked together kludge based on bleeding edge ESP IDF v3.1:</div></div><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: 18px;" class="">OVMS > metrics list m.version</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">m.version 3.0.0/factory/main build (idf v3.1-dev-168-ga1b59679) Jan 8 2018 10:09:53</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">OVMS > sd mount</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Name: SB16G</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Type: SDHC/SDXC</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Speed: default speed</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Size: 15193MB</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">SCR: sd_spec=2, bus_width=5</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">Mounted SD CARD</span></font></div></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class=""><br class=""></span></font></div><div class=""><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">OVMS > vfs ls /sd</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">.Spotlight-V100</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">.fseventsd</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">component.mk</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">sd_card_example_main.c</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">FOO.TXT</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">OVMS > vfs cp /sd/FOO.txt /sd/FOO2.txt</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">VFS copy complete</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class=""><br class=""></span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">OVMS > vfs ls /sd</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">.Spotlight-V100</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">.fseventsd</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">component.mk</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">sd_card_example_main.c</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">FOO2.TXT</span></font></div><div class=""><font face="Andale Mono" class=""><span style="font-size: 18px;" class="">FOO.TXT</span></font></div></div></blockquote><div class=""><br class=""></div><div class="">That FOO.TXT file is about 60MB in size.</div><div class=""><br class=""></div><div class="">Now finalising hardware with the china manufacturer. I think at this point, it is worth:</div><div class=""><br class=""></div><div class=""><ol class="MailOutline"><li class="">Use 1 line SD CARD (which frees up GPIOs SD_DATA1/SD_DATA2/SD_DATA3, but also avoids the conflict between GPIO12/SD_DATA2 and VDD_SDIO bootstrap pin).</li><li class="">Add some capacitors for power line smoothing, as per Espressif’s example in their test board.</li><li class="">Double-check power on SIMCOM module, to ensure it is as expected (following issues reported with low-amperage USB ports).</li><li class="">Change to use Analog Lamb WROOM-32 module and their 16MB flash + 4MB ram.</li></ol></div><div class=""><br class=""></div><div class="">Change #4 should be the only controversial one. It has the advantages of much more RAM, and no need for external flash, but the disadvantage is that we would have to move GPIOs for simcom async (as those are using by Analog Lamb for their chip). It also depends on Analog Lamb’s lead time, and future plans for this module.</div><div class=""><br class=""></div><div class="">Regards, Mark</div><div class=""><br class=""></div></body></html>