[Ovmsdev] SD CARD vs 16MB flash

Mark Webb-Johnson mark at webb-johnson.net
Mon Jan 8 10:37:37 HKT 2018


Using Espressif standard SD CARD example program, modified to write "Hello\n” 10 million times, and then read it back 10 million times...

Here is what I get with OVMS v3 developer-release hardware using release version of ESP IDF v2.1:

I (50) boot: ESP-IDF v2.1.1-8-g5ae2c0d0 2nd stage bootloader
I (51) boot: compile time 08:28:36
I (83) boot: Enabling RNG early entropy source...
I (84) boot: SPI Speed      : 40MHz
I (84) boot: SPI Mode       : DIO
I (94) boot: SPI Flash Size : 16MB
…
I (910) cpu_start: Pro cpu start user code
I (967) cpu_start: Starting scheduler on PRO CPU.
I (972) example: Initializing SD card
I (972) cpu_start: Starting scheduler on APP CPU.
E (1112) sdmmc_cmd: sdmmc_card_init: send_scr returned 0x107
E (1112) example: Failed to initialize the card (263). Make sure SD card lines have pull-up resistors in place.

Using latest (bleeding edge, not released) ESP IDF v3.1, using 1 line mode:

I (31) boot: ESP-IDF v3.1-dev-168-ga1b59679 2nd stage bootloader
I (31) boot: compile time 08:35:38
I (42) boot: Enabling RNG early entropy source...
I (42) boot: SPI Speed      : 40MHz
I (42) boot: SPI Mode       : DIO
I (45) boot: SPI Flash Size : 16MB
…
I (195) cpu_start: Pro cpu up.
I (199) cpu_start: Starting app cpu, entry point is 0x40080e38
I (0) cpu_start: App cpu up.
I (209) heap_init: Initializing. RAM available for dynamic allocation:
I (216) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (222) heap_init: At 3FFB2A48 len 0002D5B8 (181 KiB): DRAM
I (228) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (235) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (241) heap_init: At 40089270 len 00016D90 (91 KiB): IRAM
I (247) cpu_start: Pro cpu start user code
I (265) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (267) example: Initializing SD card
I (267) example: Using SDMMC peripheral
Name: SB16G
Type: SDHC/SDXC
Speed: default speed
Size: 15193MB
CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9
SCR: sd_spec=2, bus_width=5
I (347) example: Opening file
I (347) example: write count = 0 ...
I (25397) example: write count = 1000000 ...
I (50417) example: write count = 2000000 ...
I (75737) example: write count = 3000000 ...
I (101277) example: write count = 4000000 ...
I (127417) example: write count = 5000000 ...
I (154087) example: write count = 6000000 ...
I (180247) example: write count = 7000000 ...
I (206977) example: write count = 8000000 ...
I (232807) example: write count = 9000000 ...
I (259647) example: File written
I (259647) example: Renaming file
I (259657) example: Reading file
I (259657) example: read count = 0 ...
I (278507) example: read count = 1000000 ...
I (297367) example: read count = 2000000 ...
I (316427) example: read count = 3000000 ...
I (335347) example: read count = 4000000 ...
I (354327) example: read count = 5000000 ...
I (373157) example: read count = 6000000 ...
I (391637) example: read count = 7000000 ...
I (410097) example: read count = 8000000 ...
I (428517) example: read count = 9000000 ...
I (446807) example: Read from file: 'Hello'
I (446807) example: Card unmounted

and using v3.1 with 4-line mode:

I (247) cpu_start: Pro cpu start user code
I (265) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (267) example: Initializing SD card
I (267) example: Using SDMMC peripheral
Name: SB16G
Type: SDHC/SDXC
Speed: default speed
Size: 15193MB
CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9
SCR: sd_spec=2, bus_width=5
I (347) example: Opening file
I (357) example: write count = 0 ...
I (24187) example: write count = 1000000 ...
I (47637) example: write count = 2000000 ...
I (71277) example: write count = 3000000 ...
I (94927) example: write count = 4000000 ...
I (119567) example: write count = 5000000 ...
I (143517) example: write count = 6000000 ...
I (168297) example: write count = 7000000 ...
I (192597) example: write count = 8000000 ...
I (216847) example: write count = 9000000 ...
I (240587) example: File written
I (240727) example: Renaming file
I (240727) example: Reading file
I (240737) example: read count = 0 ...
I (257697) example: read count = 1000000 ...
I (274507) example: read count = 2000000 ...
I (291327) example: read count = 3000000 ...
I (308117) example: read count = 4000000 ...
I (325157) example: read count = 5000000 ...
I (341647) example: read count = 6000000 ...
I (358397) example: read count = 7000000 ...
I (375097) example: read count = 8000000 ...
I (391787) example: read count = 9000000 ...
I (408247) example: Read from file: 'Hello'
I (408247) example: Card unmounted

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.

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.

I’m working with Espressif to see if this fix can be back-ported to v2.1. I doubt it, but no harm asking…

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:

OVMS > metrics list m.version
m.version                                3.0.0/factory/main build (idf v3.1-dev-168-ga1b59679) Jan  8 2018 10:09:53

OVMS > sd mount
Name: SB16G
Type: SDHC/SDXC
Speed: default speed
Size: 15193MB
CSD: ver=1, sector_size=512, capacity=31116288 read_bl_len=9
SCR: sd_spec=2, bus_width=5
Mounted SD CARD

OVMS > vfs ls /sd
.Spotlight-V100
.fseventsd
component.mk
sd_card_example_main.c
FOO.TXT

OVMS > vfs cp /sd/FOO.txt /sd/FOO2.txt
VFS copy complete

OVMS > vfs ls /sd
.Spotlight-V100
.fseventsd
component.mk
sd_card_example_main.c
FOO2.TXT
FOO.TXT

That FOO.TXT file is about 60MB in size.

Now finalising hardware with the china manufacturer. I think at this point, it is worth:

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).
Add some capacitors for power line smoothing, as per Espressif’s example in their test board.
Double-check power on SIMCOM module, to ensure it is as expected (following issues reported with low-amperage USB ports).
Change to use Analog Lamb WROOM-32 module and their 16MB flash + 4MB ram.

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.

Regards, Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20180108/13a482a8/attachment.htm>


More information about the OvmsDev mailing list