You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pending amp commands such as ls, put, get. Sometimes it success (only ls) but most of execution Fails.
Finding the issue
I checkout the source and add the print on library and searched for the point where code was pending.
I Found that the code is pending at the line 189 of pyboard.py. The code is data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>').
defenter_raw_repl(self):
# Brief delay before sending RAW MODE char if requestsif_rawdelay>0:
time.sleep(_rawdelay)
self.serial.write(b'\r\x03\x03') # ctrl-C twice: interrupt any running program# flush input (without relying on serial.flushInput())n=self.serial.inWaiting()
whilen>0:
self.serial.read(n)
n=self.serial.inWaiting()
self.serial.write(b'\r\x01') # ctrl-A: enter raw REPLdata=self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>') # line 189ifnotdata.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
print(data)
raisePyboardError('could not enter raw repl')
self.serial.write(b'\x04') # ctrl-D: soft resetdata=self.read_until(1, b'soft reboot\r\n')
ifnotdata.endswith(b'soft reboot\r\n'):
print(data)
raisePyboardError('could not enter raw repl')
# By splitting this into 2 reads, it allows boot.py to print stuff,# which will show up after the soft reboot and before the raw REPL.# Modification from original pyboard.py below:# Add a small delay and send Ctrl-C twice after soft reboot to ensure# any main program loop in main.py is interrupted.time.sleep(0.5)
self.serial.write(b'\x03')
time.sleep(0.1) # (slight delay before second interruptself.serial.write(b'\x03')
# End modification above.data=self.read_until(1, b'raw REPL; CTRL-B to exit\r\n')
ifnotdata.endswith(b'raw REPL; CTRL-B to exit\r\n'):
print(data)
raisePyboardError('could not enter raw repl')
I also inspected the inside of self.read_util function but the most suspicious line was a line before. (self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL).
I think For some reason, The develop board missed Ctl-A character and it may fail to enter raw repl mode.
So I modified the function as follows:
defenter_raw_repl(self):
# Brief delay before sending RAW MODE char if requestsif_rawdelay>0:
time.sleep(_rawdelay)
self.serial.write(b'\r\x03\x03') # ctrl-C twice: interrupt any running program# flush input (without relying on serial.flushInput())n=self.serial.inWaiting()
whilen>0:
self.serial.read(n)
n=self.serial.inWaiting()
->time.sleep(0.5)
self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL->foriinrange(4):
->time.sleep(0.1)
->self.serial.write(b'\x01') # send ctl-A for several times->self.serial.flushOutput()
data=self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>')
# data = self.read_until(1, b'raw REPL; CTRL-B to exit\n>')ifnotdata.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
print(data)
raisePyboardError('could not enter raw repl')
->self.serial.flushInput()
self.serial.write(b'\x04') # ctrl-D: soft resetdata=self.read_until(1, b'soft reboot\r\n')
ifnotdata.endswith(b'soft reboot\r\n'):
print(data)
raisePyboardError('could not enter raw repl')
# By splitting this into 2 reads, it allows boot.py to print stuff,# which will show up after the soft reboot and before the raw REPL.# Modification from original pyboard.py below:# Add a small delay and send Ctrl-C twice after soft reboot to ensure# any main program loop in main.py is interrupted.time.sleep(0.5)
self.serial.write(b'\x03')
time.sleep(0.1) # (slight delay before second interruptself.serial.write(b'\x03')
# End modification above.data=self.read_until(1, b'raw REPL; CTRL-B to exit\r\n')
ifnotdata.endswith(b'raw REPL; CTRL-B to exit\r\n'):
print(data)
raisePyboardError('could not enter raw repl')
And the commands works well.
My opinion is that many pending issues are came from failing to enter the raw_repl mode.
It is just temporal patch and until now i have no idea more proper way to solve it.
The text was updated successfully, but these errors were encountered:
Hiya! We are discontinuing support for ampy, and will no longer be maintaining it. We are leaving this repository available for continued use. If you would like to take over supporting it, please contact us on the Adafruit Discord server and we can transfer the repository to you.
If you wish to continue developing it on your own, please fork the repository.
I want to share my experience how I (may be temporary) solve the
ampy
command pending issue.Here is my problem and temporary solution for
ampy
command pending issue.My environment
SW:
HW:
Problem
amp
commands such asls
,put
,get
. Sometimes it success (onlyls
) but most of execution Fails.Finding the issue
I checkout the source and add the print on library and searched for the point where code was pending.
I Found that the code is pending at the line
189
ofpyboard.py
. The code isdata = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>')
.I also inspected the inside of
self.read_util
function but the most suspicious line was a line before. (self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL
).I think For some reason, The develop board missed Ctl-A character and it may fail to enter
raw repl mode
.So I modified the function as follows:
And the commands works well.
My opinion is that many pending issues are came from failing to enter the
raw_repl mode
.It is just temporal patch and until now i have no idea more proper way to solve it.
The text was updated successfully, but these errors were encountered: