Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passthrough flashing #66

Merged
merged 2 commits into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions python/esptool-3.0/esptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,22 @@ def _connect_attempt(self, mode='default_reset', esp32r0_delay=False):
#
# DTR & RTS are active low signals,
# ie True = pin @ 0V, False = pin @ VCC.
if mode != 'no_reset':
if mode == 'passthru':
self._setDTR(False) # IO0=HIGH
# self._setRTS(True) # EN=LOW, chip in reset
time.sleep(0.1)
# if esp32r0_delay:
# # Some chips are more likely to trigger the esp32r0
# # watchdog reset silicon bug if they're held with EN=LOW
# # for a longer period
# time.sleep(1.2)
self._setRTS(False) # EN=HIGH, chip out of reset
time.sleep(4.0) # Wait for firmware to start
self._setDTR(True) # IO0=LOW
time.sleep(0.2)
self._setDTR(False) # IO0=HIGH, done
time.sleep(0.2)
elif mode != 'no_reset':
self._setDTR(False) # IO0=HIGH
self._setRTS(True) # EN=LOW, chip in reset
time.sleep(0.1)
Expand Down Expand Up @@ -3284,7 +3299,7 @@ def main(custom_commandline=None):
parser.add_argument(
'--before',
help='What to do before connecting to the chip',
choices=['default_reset', 'no_reset', 'no_reset_no_sync'],
choices=['default_reset', 'no_reset', 'no_reset_no_sync', 'passthru'],
default=os.environ.get('ESPTOOL_BEFORE', 'default_reset'))

parser.add_argument(
Expand Down
5 changes: 5 additions & 0 deletions targets/dupletx_tx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@ extends = env:DUPLETX_TX_Backpack_via_UART

[env:DUPLETX_TX_Backpack_via_WIFI]
extends = env:DUPLETX_TX_Backpack_via_UART

[env:DUPLETX_TX_Backpack_via_PASSTHRU]
extends = env:DUPLETX_TX_Backpack_via_UART
upload_speed = 230400
upload_command = python "$PROJECT_DIR/python/esptool-3.0/esptool.py" -b $UPLOAD_SPEED ${UPLOAD_PORT and "-p "+UPLOAD_PORT} -c esp8266 --before passthru --after soft_reset write_flash 0x0000 "$SOURCE"
5 changes: 5 additions & 0 deletions targets/happymodel_tx.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,8 @@ build_flags =

[env:HappyModel_TX_Backpack_via_WIFI]
extends = env:HappyModel_TX_Backpack_via_UART

[env:HappyModel_TX_Backpack_via_PASSTHRU]
extends = env:HappyModel_TX_Backpack_via_UART
upload_speed = 230400
upload_command = python "$PROJECT_DIR/python/esptool-3.0/esptool.py" -b $UPLOAD_SPEED ${UPLOAD_PORT and "-p "+UPLOAD_PORT} -c esp8266 --before passthru --after soft_reset write_flash 0x0000 "$SOURCE"