[Ovmsdev] SD CARD

Edward Cheeseman cheesemanedward at gmail.com
Mon Nov 6 17:57:40 HKT 2017


Minimum high input voltage is 0.75*3.3V=2.475. 2.576 would be very marginal at speed. You need to get it higher for any reliability. I think it explains the nearly working but not quite!

Am i right the only thing that provides the high voltage is the 10k pull ups on the SD card reader? Maybe try bringing them down a little to say 3k3 or 4k7? If you do that the 100k on the transistor base terminals might be a bit light. Maybe bring them back to 10k or so.

Not sure how it could affect things, but the capacitor across sw1 may slow down the EN line?

I think the burn the boot fuses so the pull downs and transistors can be eliminated would be worth considering.

Pot shots unfortunately without having one in my hands.

Edward


> On 27/10/2017, at 3:26 AM, Mark Webb-Johnson <mark at webb-johnson.net> wrote:
> 
> 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.
> 
> We are just following the standard Espressif schematics for this. Here is Espressif’s master document on it:
> 
> https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card <https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card>
> 
> 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.
> 
> 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.
> 
> We want 4-wire, but let’s start with a simple 1-wire diagram on a breadboard (as per Espressif instructions):
> 
> ESP32 pin	SD card pin	SPI pin	Notes
> GPIO14 (MTMS)	CLK	SCK	10k pullup in SD mode
> GPIO15 (MTDO)	CMD	MOSI	10k pullup, both in SD and SPI modes
> GPIO2	D0	MISO	10k pullup in SD mode, pull low to go into download mode (see note below!)
> GPIO4	D1	N/C	not used in 1-line SD mode; 10k pullup in 4-line SD mode
> GPIO12 (MTDI)	D2	N/C	not used in 1-line SD mode; 10k pullup in 4-line SD mode (see note below!)
> GPIO13 (MTCK)	D3	CS	not used in 1-line SD mode, but card's D3 pin must have a 10k pullup
> N/C	CD		optional, not used in the example
> N/C	WP		optional, not used in the example
> 
> Also:
> Connect GPIO0 and GPIO2 using a jumper (so transistors drive GPIO2 and GPIO0 low when entering download mode (10K pullup otherwise)
> 3.3V connect to SDCARD
> GND connect to SDCARD
> 
> 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).
> 
> 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.
> 
> 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.
> 
> I don’t think it ever worked. Just before our test was so simple that it didn’t show the problem.
> 
> So, I just purchased one of these:
> 
> https://www.banggood.com/ESP32-Development-Board-WiFiBluetooth-Ultra-Low-Power-Consumption-Dual-Cores-ESP-32-ESP-32S-Board-p-1109512.html <https://www.banggood.com/ESP32-Development-Board-WiFiBluetooth-Ultra-Low-Power-Consumption-Dual-Cores-ESP-32-ESP-32S-Board-p-1109512.html>
> 
> Geekcreit® ESP32 Development Board WiFi+Bluetooth Ultra Low Power Consumption Dual Cores ESP-32 ESP-32S Board
> 
> (Very similar to DEVKIT C, but more modern)
> 
> 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.
> 
> 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).
> 
> Espressif SD CARD notes here:
> 
> https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card <https://github.com/espressif/esp-idf/tree/master/examples/storage/sd_card>
> 
> Schematic for Geekcreit board is here:
> 
> https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0 <https://www.dropbox.com/s/jefwxxtufgwg0ex/esp32_Schematic%20Prints.pdf?dl=0>
> 
> <PastedGraphic-4.tiff>
> 
> Schematic for latest version of Espressif DEVKIT C board is here:
> 
> http://espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf <http://espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf>
> 
> <PastedGraphic-5.tiff>
> 
> The original DEVKIT C (v1) had 1K resistors on that circuit. This is the version I have.
> 
> The Geekcreit has 10K resistors on that circuit.
> 
> OVMS has 10K resistors on that circuit.
> 
> The latest DEVKIT C (v3) has 12K resistors on that circuit.
> 
> DEVKIT C v1 schematic is here: http://dl.espressif.com/dl/schematics/ESP32-DevKitJ-v1_sch.pdf <http://dl.espressif.com/dl/schematics/ESP32-DevKitJ-v1_sch.pdf>
> DEVKIT C v2 schematic is here: http://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf <http://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-2.pdf>
> 
> The latest Espressif ROVER KIT development board schematic is here:
> 
> https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-3.pdf <https://dl.espressif.com/dl/schematics/ESP-WROVER-KIT_SCH-3.pdf>
> 
> <PastedGraphic-6.tiff>
> 
> <PastedGraphic-7.tiff>
> 
> Note that they are now using 100K resistors, and a separate transistor on IO0 (to allow it to be independently controlled after boot).
> 
> I am reasonably certain our SD CARD problem concerns the GPIO0-GPIO2 link.
> 
> 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.
> 
> Regards, Mark.
> _______________________________________________
> OvmsDev mailing list
> OvmsDev at lists.teslaclub.hk
> http://lists.teslaclub.hk/mailman/listinfo/ovmsdev

Edward Cheeseman
Electrical Engineer
cheesemanedward at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.teslaclub.hk/pipermail/ovmsdev/attachments/20171106/1af531f2/attachment-0001.html>


More information about the OvmsDev mailing list