Bootloader woes and SD card pull-ups
Posted: 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.
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.