How to read / write the "GPIO_STRAPPING" register
Posted: Mon Jun 27, 2022 1:16 am
Hi, we are trying to diagnose and work around problems relating to boot strapping pins and VDD_SDIO. I would like to be write the "GPIO_STRAPPING" register from my application, after boot (to control VDD_SDIO).
From the ESP32 data sheet, under "2.4 Strapping Pins":
However, when executed, the log shows that the bit is not set:
Is it possible to set “Voltage of Internal LDO (VDD_SDIO)” after boot, as mentioned in the data sheet?
The reason for this madness is that, due to a hardware design problem, the board may sometimes boot up with the "MTDI" pin not quite pulled low enough, resulting in the wrong VDD_SDIO being selected.
EDIT: I fixed the earlier crash bug - I was using the wrong const. It's "GPIO_STRAP_REG", not "GPIO_STRAPPING".
-----
ESP-IDF 4.4
chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
Flash:
Manufacturer: c8
Device: 4017
Detected flash size: 8MB
From the ESP32 data sheet, under "2.4 Strapping Pins":
Software can read the values of these five bits from register ”GPIO_STRAPPING”
I have added the following code to read the register then set the "MTDI" pin bit:Firmware can configure register bits to change the settings of “Voltage of Internal LDO (VDD_SDIO)” and “Timing
of SDIO Slave”, after booting
Code: Select all
#include "soc/dport_reg.h"
#include "soc/gpio_reg.h"
...
uint32_t gpio_strapping = DPORT_REG_READ(GPIO_STRAP_REG);
ESP_LOGI("DEBUG", COLOUR_YELLOW "Strapping WAS: 0x%04X", gpio_strapping);
uint32_t correct_gpio_strapping = 0x0013;
DPORT_REG_WRITE(GPIO_STRAP_REG, correct_gpio_strapping);
gpio_strapping = DPORT_REG_READ(GPIO_STRAP_REG);
ESP_LOGI("DEBUG", COLOUR_YELLOW "Strapping NOW: 0x%04X", gpio_strapping);
Code: Select all
I (1242) DEBUG: Strapping WAS: 0x0033
I (1242) DEBUG: Strapping NOW: 0x0033
The reason for this madness is that, due to a hardware design problem, the board may sometimes boot up with the "MTDI" pin not quite pulled low enough, resulting in the wrong VDD_SDIO being selected.
EDIT: I fixed the earlier crash bug - I was using the wrong const. It's "GPIO_STRAP_REG", not "GPIO_STRAPPING".
-----
ESP-IDF 4.4
chip is ESP32-D0WD-V3 (revision 3)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
Flash:
Manufacturer: c8
Device: 4017
Detected flash size: 8MB