Merge branch 'feature/esptool_espefuse_set_flash_voltage' into 'master'

esptool version bump and new "espefuse.py set_flash voltage" command

* New "espefuse.py set_flash_voltage" command to easily set a fix
  VDD_SDIO regulator voltage (1.8V, 3.3V or disabled).
* Fixes bugs when flashing files with non-4-byte aligned lengths
  (doesn't effect esp-idf image files)
* esptool README improvements
* Detect overlapping files in write_flash
* read_mac now works correctly on ESP32
* Integrates reset fix for older dev boards (formerly the "Windows ESP32R0 reset workaround")


See merge request !481
This commit is contained in:
Angus Gratton 2017-03-07 07:08:18 +08:00
commit 9f7d8c338e
3 changed files with 13 additions and 22 deletions

View File

@ -140,24 +140,16 @@ choice ESPTOOLPY_BEFORE
wired from the serial port to the ESP32. Most USB development
boards do this internally.
The "Reset with ESP32R0 Windows workaround" option works
around an automatic reset bug in hardware, when using Windows
with some development boards. This fix only works if you're
using a silicon revision 0 ESP32.
config ESPTOOLPY_BEFORE_RESET
bool "Reset to bootloader"
config ESPTOOLPY_BEFORE_NORESET
bool "No reset"
config ESPTOOLPY_BEFORE_ESP32R0
bool "Reset with ESP32R0 Windows workaround"
endchoice
config ESPTOOLPY_BEFORE
string
default "default_reset" if ESPTOOLPY_BEFORE_RESET
default "no_reset" if ESPTOOLPY_BEFORE_NORESET
default "esp32r0" if ESPTOOLPY_BEFORE_ESP32R0
choice ESPTOOLPY_AFTER
prompt "After flashing"

@ -1 +1 @@
Subproject commit e9e9179f6fc3f2ecfc568987d3224b5e53a05f06
Subproject commit 907273664ada32fc33f3fbfeba99550512c67e4d

View File

@ -37,25 +37,24 @@ GPIO2 pin is used as a bootstrapping pin, and should be low to enter UART downlo
### Note about GPIO12
GPIO12 is used as a bootstrapping pin to select output voltage of an internal regulator which powers the flash chip.
GPIO12 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, GPIO12 can be pulled high.
- On boards which use the internal regulator and a 3.3V flash chip, GPIO12 should be pulled up high, which is compatible with SD card operation.
- For boards which use 3.3V flash chip, GPIO12 needs to be low at reset.
* In this case, internal pullup can be enabled using a `gpio_pullup_en(GPIO_NUM_12);` call. Most SD cards work fine when an internal pullup on GPIO12 line is enabled. Note that if ESP32 experiences a power-on reset while the SD card is sending data, high level on GPIO12 can be latched into the bootstrapping register, and ESP32 will enter a boot loop until external reset with correct GPIO12 level is applied.
* Another option is to program flash voltage selection efuses: set `XPD_SDIO_TIEH=1`, `XPD_SDIO_FORCE=1`, and `XPD_SDIO_REG = 1`. This will permanently select 3.3V output voltage for the internal regulator, and GPIO12 will not be used as a bootstrapping pin anymore. Then it is safe to connect a pullup resistor to GPIO12. This option is suggested for production use.
- 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, 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, 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. Most SD cards work fine when an internal pullup on GPIO12 line is enabled. Note that if ESP32 experiences a power-on reset while the SD card is sending data, high level on GPIO12 can be latched into the bootstrapping register, and ESP32 will enter a boot loop until external reset with correct GPIO12 level is applied.
* 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.
The following commands can be used to program flash voltage selection efuses **to 3.3V**:
The following command can be used to program flash voltage selection efuses **to 3.3V**:
```sh
# Override flash regulator configuration using efuses
components/esptool_py/esptool/espefuse.py burn_efuse XPD_SDIO_FORCE
# Select 3.3V output voltage
components/esptool_py/esptool/espefuse.py burn_efuse XPD_SDIO_TIEH
# Enable internal voltage regulator
components/esptool_py/esptool/espefuse.py burn_efuse XPD_SDIO_REG
components/esptool_py/esptool/espefuse.py set_flash_voltage 3.3V
```
This command will burn the `XPD_SDIO_TIEH`, `XPD_SDIO_FORCE`, and `XPD_SDIO_REG` efuses. With all three burned to value 1, the internal VDD_SDIO flash voltage regulator is permanently enabled at 3.3V. See the technical reference manual for more details.
`espefuse.py` has a `--do-not-confirm` option if running from an automated flashing script.
## 4-line and 1-line modes
By default, example code uses the following initializer for SDMMC host peripheral configuration: