Skip to content

Commit

Permalink
Passthrough flashing (#66)
Browse files Browse the repository at this point in the history
* DUPLETX & HM target with UART passthrough flashing

* Beef up the passthrough speed
  • Loading branch information
pkendall64 committed May 2, 2022
1 parent d8efaf3 commit 3c03159
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
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"

0 comments on commit 3c03159

Please sign in to comment.