Bootloader woes and SD card pull-ups

User avatar
supersat
Posts: 10
Joined: Tue Apr 11, 2017 10:17 pm

Bootloader woes and SD card pull-ups

Postby supersat » Fri May 19, 2017 5:42 am

In the latest rev of my board I moved the SD card connections from the confusingly-named SD_* pins to the JTAG pins (MTMS, MTDI, MTCK, MTDO, GPIO2, GPIO4). Unfortunately, I've been tearing my hair out for the past few days trying to figure out why the bootloader doesn't see the flash of the ESP-WROOM-32 module I'm using. I knew I had to explicitly set the VDD_SDIO regulator fuses to 3.3v, which I did successfully. However, the bootloader *still* wouldn't see the flash. It turns out I forgot about the GPIO2 strapping pin, and that it needs to be pulled low for download mode. But this raises many questions.

1. When GPIO2 is pulled high, the ESP32 boots into UART_BOOT mode, as opposed to DOWNLOAD_BOOT mode. What is the difference between these two modes? UART_BOOT doesn't seem to be documented at all.

2. I suspect the UART_BOOT mode allowed esptool/espefuse to upload its own stub, which allowed me to set and confirm the fuses, MAC address, etc. However, the SPI flash didn't work. Is it possible to modify the stub to get the flash interface working, or is there something fundamentally different about UART_BOOT mode which prevents access to the flash?

3. Given that both GPIO2 and GPIO12 are used as strapping pins and SD card pins, and the recommendation to use pull-up resistors with SD cards, would it be possible/recommended to use the internal pull-up registers of the ESP32 instead of external resistors? This would avoid a lot of these issues.

Basically, I'm wondering if I should keep the external pull-up resistors and modify the esptool stub (if it's possible), or remove them and rely on the ESP32's internal pull-ups. GPIO0 is used for other things besides selecting the boot mode, so the trick of tying GPIO0 and GPIO2 together won't work.

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Bootloader woes and SD card pull-ups

Postby ESP_igrr » Fri May 19, 2017 9:44 am

If would post your boards schematic, it may help understand your problem better.
In general, you do need external pullups for SD card (internal ones are not adequate for high speed cards), and your download mode circuit needs to pull GPIO2 low on download (just as it pulls low GPIO0).

User avatar
supersat
Posts: 10
Joined: Tue Apr 11, 2017 10:17 pm

Re: Bootloader woes and SD card pull-ups

Postby supersat » Sat May 27, 2017 2:12 am

I've attached a simplified schematic. What I'm hoping to use:

1. SD card
2. SPI bus for LCD
3. Internal stereo DAC
4. Internal ADC
5. I2C
6. 32.768kHz crystal
7. At least two touch pads

I have fairly limited options for pin assignments. GPIO2 is used by the SD card. GPIO0 is tri-stated by the USB controller if it's not resetting into the bootloader, allowing it to also be used as a touch pad, so I can't simply connect GPIO0 and GPIO2 together as suggested in the SD card example. (Yeah, it's probably not the best idea to share it like that, but it's good enough for hobbyist use.)

It seems like my options are:

1. Remove the pull-up on SD0 and hope for the best.
2. Remove the 32.768kHz crystal and move one touch pad to that, allowing GPIO0 and GPIO2 to be connected.
3. Get the esptool stub to work with the SPI flash when loaded in UART boot mode?
4. Route signals through the GPIO matrix?
5. Something else?
Attachments
esp32-boot-issue.png
esp32-boot-issue.png (115.36 KiB) Viewed 14098 times

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: Bootloader woes and SD card pull-ups

Postby ESP_igrr » Sat May 27, 2017 2:59 am

Instead of connecting IO2 and IO0, can you drive each of them to low logic level when in download mode? This way both pins will be low (as required by bootloader) but will still be allowed to work independently when not in download mode. Here's a part of the schematic of WROVER-KIT where we have added the third transistor to do that.
Screen Shot 2017-05-27 at 10.59.07.png
Screen Shot 2017-05-27 at 10.59.07.png (66.85 KiB) Viewed 14097 times

Nelapsi
Posts: 6
Joined: Wed May 10, 2017 10:13 am

Re: Bootloader woes and SD card pull-ups

Postby Nelapsi » Wed May 31, 2017 12:02 pm

Hi guys,

I am bit confused with this, I am not so experienced in the hardware part.

In my case I also use an SD card but I have the ESP32_core_board_V2 (https://www.adafruit.com/product/3269).

I've searched for the shcematics Image, and I am using the SD card connected as follows:
ESP32DevBoard SD
GPIO14 (MTMS) ----> CLK ---- 10k pullup
GPIO 15 (MTD0) ---> CMD ---- 10k pullup
GPIO 2 --------------> D0 ---- 10k pullup (here needs the pulldown in dorder to go to download mode)
GPIO 4 --------------> D1 ---- 10k pullup** (Currently I'am not using it because 4-bit mode didn't work)
GPIO 12 (MTDI) ----> D2 ---- 10k pullup** (Currently I'am not using it because 4-bit mode didn't work)
GPIO 13 (MTCK) ---> D3 ---- 10k pullup
N/c CD
N/c WP

So, connected like that, in 1-bit mode I can program the ESP32 dev board (connected to nothing), then unplug the USB and connect the ESP32 dev board to the bread board with the SD connections shown above.

Could you please tell me how it should be connected to be capable of using 4-bit mode and, more important now, to be able of go to download mode, flash and reset without having to disconnect the SD pins every time?

Last thing, adding the Q9, as in the picture form the post above, to the schematic of the ESP32DevBoard would solve this issue or is there anything else needed too.

Thanks.

Who is online

Users browsing this forum: Bing [Bot] and 57 guests