Skip to content

Raw REPL crashing  #251

@eighthree

Description

@eighthree

It's possible for Raw REPL to stop working properly if main.py contains code that looks like what I whipped up below:

main.py contents

import time
from machine import ADC

x = True
while True:
  startMillis = time.monotonic()
  signalMax = 0
  signalMin = 1023
while time.monotonic() - startMillis < 10:
  adc = ADC(0)
  sample = adc.read()
if sample < 1024:
  if sample > signalMax:
      signalMax = sample
  elif sample < signalMin:
      signalMin = sample
peakToPeak = signalMax - signalMin
print(peakToPeak)

Normally, I'd get something like:
ampy.pyboard.PyboardError: ('exception', '', 'Traceback (most recent call last):\r\n File "<stdin>", line 14\r\nSyntaxError: invalid syntax\r\n')
but running this main.py code through ampy causes terminal to hang.

To reproduce

  1. ) Flash CP 2.0.0 rc2 on an ESP8266
  2. ) Run main.py (hangs)
  3. ) Put main.py (works ok!)
  4. ) Reset/Unplug unit
  5. ) Try running main.py through ampy (hangs) *
  6. ) screen /dev/ttyUSB0 115200 (see video for behaviour)
  7. ) Try running -or- putting file via ampy returns File "/usr/local/lib/python2.7/dist-packages/ampy/pyboard.py", line 202, in enter_raw_repl raise PyboardError('could not enter raw repl') ampy.pyboard.PyboardError: could not enter raw repl

Observed on an ESP8266 running CP 2.0.0-rc.2 / Ubuntu 16
Latest ampy & esptools

I've attached a screen captured video (webm format) demonstrating this issue:
ESP Development Environment-2017-09-12T01-24-24-828588200Z.zip

Here's the error when trying to use ampy when the Raw REPL fails:

Traceback (most recent call last):
  File "/usr/local/bin/ampy", line 11, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ampy/cli.py", line 271, in run
    output = board_files.run(local_file, not no_output)
  File "/usr/local/lib/python2.7/dist-packages/ampy/files.py", line 221, in run
    self._pyboard.enter_raw_repl()
  File "/usr/local/lib/python2.7/dist-packages/ampy/pyboard.py", line 202, in enter_raw_repl
    raise PyboardError('could not enter raw repl')
ampy.pyboard.PyboardError: could not enter raw repl

What fixes the issue
Re-flash the firmware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions