How to handle Strapping Pin (GPIO 12 / MTDI) ?

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

How to handle Strapping Pin (GPIO 12 / MTDI) ?

Post by water » Sun Feb 11, 2018 5:14 pm

I connect SD card to ESP-WROOM-32 's GPIO 12, GPIO 13, GPIO 14, GPIO 15, GPIO 2, GPIO 4, and must pull-up via 10K resistance to 3.3V, but when GPIO 12(MTDI) pull-up, Micropython will appear this message loop:

*****
rst:0x10 (RTCWDT_RTC_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun 8 2016 00:22:57

*****

when disconnect pull-up resistance, Micropython is back to correct boot.

I find it GPIO 12(MTDI) is a strapping Pin in ESP-WROOM-32 offcial datasheet, and Pull-down in default.

Image

I'm not ensure the Strapping Pin is the source of this reset loop problem.

Anyone met same problem? and how to handle this case (GPIO 12 / MTDI need to pull-up) ?

loboris
Posts: 344
Joined: Fri Oct 02, 2015 6:19 pm

Re: How to handle Strapping Pin (GPIO 12 / MTDI) ?

Post by loboris » Sun Feb 11, 2018 8:08 pm

GPIO12 (MTDI) is used as a bootstrapping pin to select output voltage of an internal regulator which powers the flash chip (VDD_SDIO).
This pin has an internal pulldown so if left unconnected it will read low at reset (selecting default 3.3V operation).
When adding a pullup to this pin for SD card operation, consider the following:

- For boards which don't use the internal regulator (VDD_SDIO) to power the flash, GPIO12 can be pulled high.
- For boards which use 1.8V flash chip (e.g. WROVER), GPIO12 needs to be pulled high at reset. This is fully compatible with SD card operation.

- On boards which use the internal regulator and a 3.3V flash chip (e.g. ESP-WROOM-32), GPIO12 must be low at reset. This is incompatible with SD card operation.

In most cases, external pullup can be omitted and an internal pullup can be enabled using a gpio_pullup_en(GPIO_NUM_12); call.
This is handled by SDCard driver.

Another option is to burn the flash voltage selection efuses.
This will permanently select 3.3V output voltage for the internal regulator, and GPIO12 will not be used as a bootstrapping pin.
Then it is safe to connect a pullup resistor to GPIO12.
This option is suggested for production use.

Code: Select all

<esp-idf_path>/components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V
You can also use sdcard in 1-line SD mode in which case GPIO12 (MTDI) is not used.

User avatar
water
Posts: 75
Joined: Sun Sep 24, 2017 9:16 am

Re: How to handle Strapping Pin (GPIO 12 / MTDI) ?

Post by water » Mon Feb 12, 2018 8:26 pm

Very minutely, thanks.

Post Reply