← index #16142Issue #9659
Related · high · value 1.002
QUERY · ISSUE

mpremote: unable to execute fs commands - mpremote.transport.TransportError: could not enter raw repl

openby maxpopened 2024-11-03updated 2025-10-27
bugtools

Port, board and/or hardware

esp32 wroom

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Generic ESP32 module with ESP32
mpremote 1.24.0

Reproduction

mpremote fs ls failed with
mpremote.transport.TransportError: could not enter raw repl

Expected behaviour

expected

mpremote fs ls
ls :
           0 mrequests/

Observed behaviour

b'MicroPython v1.23.0 on 2024-06-02; Generic ESP32 module with ESP32\r\nType "help()" for more information.\r\n>>> '
Traceback (most recent call last):
  File "/opt/homebrew/bin/mpremote", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/main.py", line 538, in main
    handler_func(state, args)
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/commands.py", line 294, in do_filesystem
    state.ensure_raw_repl()
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/main.py", line 480, in ensure_raw_repl
    self.transport.enter_raw_repl(soft_reset=soft_reset)
  File "/opt/homebrew/lib/python3.11/site-packages/mpremote/transport_serial.py", line 139, in enter_raw_repl
    raise TransportError("could not enter raw repl")
mpremote.transport.TransportError: could not enter raw repl

Additional Information

My temporary workaround is additional time.sleep(1) at line
https://github.com/micropython/micropython/blob/0e490b7c8f32bb72c516985abe67147b9385dc34/tools/mpremote/mpremote/transport_serial.py#L125
before flush input.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

mpremote: on ESPxxx all mpremote commands are followed by a hard reboot

closedby Josverlopened 2022-10-17updated 2025-07-31
bug

according to @jimmo mpremote should be able to resume a repl session on a connected mcu without a reboot by using the following command pattern:

mpremote connect exec "start_something()"
mpremote connect resume exec "continue_here()"

where the resume is the important part.
see Discord discussion

however when I try this :

  1. I see that any variables set in the the first mpremote commands are lost
  2. I see that the esp32 performs a soft reset after exiting the raw REPL
    (observed through logic analyzer)

So even though the 2nd mpremote command does not force a reset, by that time a soft reboot has already occurred.
I also see a soft reset after:

  • exiting the repl
  • eval "42"
  • exec "print(42)"

Actual result on windows :

C:\develop\usb>mpremote exec "foo=bar=42;print(foo)"
42

C:\develop\usb>mpremote resume exec "print(bar)"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'bar' isn't defined

Expected

the MCU not to reset between two mpremote commands similar to the behavour on linux

$ mpr exec "foo=bar=42; print(foo)"
42
$ mpr exec "print(bar)"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'bar' isn't defined
$ mpr exec "foo=bar=42; print(foo)"
42
$ mpr resume exec "print(bar)"
42

results as seen by a logic analyzer hooked up to the RX/TX pins of the esp32
image

\x01\x03
>>> 
>>> 
>>> 
>>> 
raw REPL; CTRL-B to exit
\x02OKx05A\x01foo=bar=43;print(foo)\x04
MPY: soft reboot
raw REPL; CTRL-B to exit
>R\x01\x80\0\x01\x0443
\x04\x04>ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12448
load:0x40080400,len:4124
entry 0x40080680
MicroPython v1.19.1 on 2022-06-18; 4MB/OTA module with ESP32
Type "help()" for more information.
>>> 
>>> 
>>> 
>>> 
>>> 
raw REPL; CTRL-B to exit
\x02R\x01\x80\0\x01\x04\x04Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'foo' isn't defined
\x04>ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:4540
ho 0 tail 12 room 4
load:0x40078000,len:12448
load:0x40080400,len:4124
entry 0x40080680
MicroPython v1.19.1 on 2022-06-18; 4MB/OTA module with ESP32
Type "help()" for more information.
>>> 

other observations

  • same behavior is observed with multiple firmware versions, and on different boards
  • esp8266 devices do NOT soft-reset in the same way ( note: all my esp8266 devices use a different serialport driver)

Versions

  • mpremote : 0.4.0
  • pyserial: 3.5
  • Python 3.9.13
  • Version: 1.72.2 (user setup)
  • OS: Windows_NT x64 10.0.22621
  • Micropython - v1.19.1
  • MCU - all esp32
  • serial port driver esp32 : Silicon Laboratories Inc. 11.1.0.53
  • serial port driver esp8266 : wch.cn - No version or other details
> mpremote devs
COM9 01665F52 10c4:ea60 Silicon Labs None # esp32
COM11 0001 10c4:ea60 Silicon Labs None # esp32 
COM20 00000000A 0403:6001 FTDI None # UART debug 
COM21  1a86:7523 wch.cn None # ESP8266

firmwares

  • mpremote connect com9 get-info
    {'ver': 'v1.19.1', 'build': '', 'platform': 'esp32', 'port': 'esp32', 'machine': 'ESP32 module (spiram) with ESP32', 'release': '1.19.1', 'nodename': 'esp32', 'name': 'micropython', 'family': 'micropython', 'sysname': 'esp32', 'version': '1.19.1'}
  • mpremote connect com11 get-info
    {'ver': 'v1.19.1', 'build': '', 'platform': 'esp32', 'port': 'esp32', 'machine': '4MB/OTA module with ESP32', 'release': '1.19.1', 'nodename': 'esp32', 'name': 'micropython', 'family': 'micropython', 'sysname': 'esp32', 'version': '1.19.1'}
  • mpremote connect com21 get-info
    {'ver': 'v1.19.1', 'build': '', 'platform': 'esp8266', 'port': 'esp8266', 'machine': 'ESP module (1M) with ESP8266', 'release': '1.19.1', 'nodename': 'esp8266', 'name': 'micropython', 'family': 'micropython', 'sysname': 'esp8266', 'version': '1.19.1'}

oldest firmware tested with same behavior:

  • mpremote connect com9 get-info
    {'ver': 'v1.10', 'build': '', 'platform': 'esp32', 'port': 'esp32', 'machine': 'ESP32 module with ESP32', 'release': '1.10.0', 'nodename': 'esp32', 'name': 'micropython', 'family': 'micropython', 'sysname': 'esp32', 'version': '1.10.0'}

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied