The difference between this and the other issues was that with the esp32 it just hangs, with the previous issue I would get the well known 'cannot enter raw repl' error.
I might be successful once in 20 attempts, each attempt I can either do a hard reset or completely disconnect & reconnect the uart / serial port, but it makes no difference.
I 'suspect' that it is related to all of the startup data that is emitted by thye ESP32 when it starts, but having spent seveal hours trying to nail down the cause I have made little progress.
I do not have a main.py file or use a main.py file with a single 'pass' just to eliminate the error message about not being able to find the main.py file
Code: Select all
pass
Code: Select all
import esp
esp.osdebug(None)
Code: Select all
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (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:0x3fff0018,len:4
load:0x3fff001c,len:4484
load:0x40078000,len:0
load:0x40078000,len:11816
entry 0x4007a9fc
I (214) cpu_start: Pro cpu up.
I (214) cpu_start: Single core mode
I (215) heap_init: Initializing. RAM available for dynamic allocation:
I (218) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (224) heap_init: At 3FFC5098 len 0001AF68 (107 KiB): DRAM
I (230) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (237) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (243) heap_init: At 4008DD1C len 000122E4 (72 KiB): IRAM
I (249) cpu_start: Pro cpu start user code
I (43) cpu_start: Starting scheduler on PRO CPU.
MicroPython v1.9.3-615-g74ab341d-dirty on 2018-05-05; ESP32 module with ESP32
Type "help()" for more information.
>>>
Code: Select all
def enter_raw_repl(self):
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()
while n > 0:
self.serial.read(n)
n = self.serial.inWaiting()
print(1)
time.sleep(0.6) ## HACK FOR 8285 / WEE-MOS MINI LITE #
self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL
data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n>')
if not data.endswith(b'raw REPL; CTRL-B to exit\r\n>'):
print(data)
raise PyboardError('could not enter raw repl')
print(2)
self.serial.write(b'\x04') # ctrl-D: soft reset
data = self.read_until(1, b'soft reboot\r\n')
if not data.endswith(b'soft reboot\r\n'):
print(data)
raise PyboardError('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\x03')
# End modification above.
data = self.read_until(1, b'raw REPL; CTRL-B to exit\r\n')
if not data.endswith(b'raw REPL; CTRL-B to exit\r\n'):
print(data)
raise PyboardError('could not enter raw repl')
If I add code to dump all of the serial output after sending ctrl-a:
Code: Select all
self.serial.write(b'\r\x01') # ctrl-A: enter raw REPL
time.sleep(0.5)
print(self.serial.read(self.serial.inWaiting()))
Code: Select all
b''
Also, if I enter the repl when the pyboard attempt failed using my console (osx), it is impossible to escape the raw repl mode using CTRL-B, the only way is a hard reset.
There is absolutely no problem entering the repl from the console, this never fails.
Not really sure what else I can do to debug this, is everyone else successfully using pyboard - related utils on the ESP32 build successfully and this problem is only happening to me ??