Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
8394333c
Commit
8394333c
authored
Jul 02, 2015
by
Johny Mattsson
Browse files
Pull in upstream fixes for getting board into flash mode.
parent
125d2173
Changes
1
Hide whitespace changes
Inline
Side-by-side
tools/esptool.py
View file @
8394333c
...
@@ -128,38 +128,32 @@ class ESPROM:
...
@@ -128,38 +128,32 @@ class ESPROM:
def
connect
(
self
):
def
connect
(
self
):
print
'Connecting...'
print
'Connecting...'
# RTS = CH_PD (i.e reset)
for
_
in
xrange
(
4
):
# DTR = GPIO0
# issue reset-to-bootloader:
# self._port.setRTS(True)
# RTS = either CH_PD or nRESET (both active low = chip in reset)
# self._port.setDTR(True)
# DTR = GPIO0 (active low = boot to flasher)
# self._port.setRTS(False)
self
.
_port
.
setDTR
(
False
)
# time.sleep(0.1)
self
.
_port
.
setRTS
(
True
)
# self._port.setDTR(False)
time
.
sleep
(
0.05
)
self
.
_port
.
setDTR
(
True
)
# NodeMCU devkit
self
.
_port
.
setRTS
(
False
)
self
.
_port
.
setRTS
(
True
)
time
.
sleep
(
0.05
)
self
.
_port
.
setDTR
(
True
)
self
.
_port
.
setDTR
(
False
)
time
.
sleep
(
0.1
)
self
.
_port
.
setRTS
(
False
)
self
.
_port
.
timeout
=
0.3
# worst-case latency timer should be 255ms (probably <20ms)
self
.
_port
.
setDTR
(
False
)
for
_
in
xrange
(
4
):
time
.
sleep
(
0.1
)
try
:
self
.
_port
.
setRTS
(
True
)
self
.
_port
.
flushInput
()
time
.
sleep
(
0.1
)
self
.
_port
.
flushOutput
()
self
.
_port
.
setDTR
(
True
)
self
.
sync
()
self
.
_port
.
setRTS
(
False
)
self
.
_port
.
timeout
=
5
time
.
sleep
(
0.3
)
return
self
.
_port
.
setDTR
(
True
)
except
:
time
.
sleep
(
0.05
)
self
.
_port
.
timeout
=
0.5
# this is a workaround for the CH340 serial driver on current versions of Linux,
for
i
in
xrange
(
10
):
# which seems to sometimes set the serial port up with wrong parameters
try
:
self
.
_port
.
close
()
self
.
_port
.
flushInput
()
self
.
_port
.
open
()
self
.
_port
.
flushOutput
()
self
.
sync
()
self
.
_port
.
timeout
=
5
return
except
:
time
.
sleep
(
0.1
)
raise
Exception
(
'Failed to connect'
)
raise
Exception
(
'Failed to connect'
)
""" Read memory address in target """
""" Read memory address in target """
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment