I have a mistake with my lolin32 lite with micropython.
My esp32 is :
With rshell I load a little python program to control a stepper motor.esptool chip_id
esptool.py v2.1
Connecting....
Detecting chip type... ESP32
Chip is ESP32D0WDQ6 (revision 1)
Enabling default SPI flash mode...
Chip ID: 0xd630aea43915
Code: Select all
import machine
import utime
MICROSTEP_RESOLUTION = {
'FULL': (1, (0, 0, 0)),
'HALF': (2, (1, 0, 0)),
'QUARTER': (4, (0, 1, 0)),
'EIGHTH': (8, (1, 1, 0)),
'SIXTEENTH': (16, (1, 1, 1)),
}
def one_step(val):
step.value(0)
utime.sleep_us(1)
step.value(1)
def set_resolution(msx):
ms1.value(msx[0])
ms2.value(msx[1])
ms3.value(msx[2])
def change_way(val):
print("value ", val.value())
if val.value() == 0:
direction.value(not direction.value())
step = machine.Pin(19, machine.Pin.OUT, machine.Pin.PULL_UP)
ms3 = machine.Pin(5, machine.Pin.OUT, machine.Pin.PULL_UP)
ms2 = machine.Pin(17, machine.Pin.OUT, machine.Pin.PULL_UP)
ms1 = machine.Pin(16, machine.Pin.OUT, machine.Pin.PULL_UP)
enable = machine.Pin(4, machine.Pin.OUT, machine.Pin.PULL_UP)
com = machine.Pin(2, machine.Pin.OUT, machine.Pin.PULL_UP)
direction = machine.Pin(22, machine.Pin.OUT, machine.Pin.PULL_UP)
fermeture = machine.Pin(15, machine.Pin.IN, machine.Pin.PULL_UP)
resolution = "SIXTEENTH"
set_resolution(MICROSTEP_RESOLUTION[resolution][1])
tick_number = 200 * MICROSTEP_RESOLUTION[resolution][0]
enable.value(0)
time = 5
sleep_time = time * 1000000 / tick_number
print(sleep_time)
fermeture.value(0)
fermeture.irq(handler=change_way, trigger=machine.Pin.IRQ_FALLING)
direction.value(1)
timer = machine.Timer(4)
timer.init(
period=int(sleep_time / 1000),
mode=machine.Timer.PERIODIC,
callback=one_step)
while True:
pass
Since I can't connect with rshell, it stay like :
And nothing next.rshell --buffer-size=30 -p /dev/ttyUSB0
Connecting to /dev/ttyUSB0 ...
I try to erase the flash with a file contains 4MB of 0xFF and then load the last stable micropython firmware :
The flashing works be still impossible to connect to the boardesptool --chip esp32 --port /dev/ttyUSB0 write_flash -z 0x1000 esp32-20180511-v1.9.4.bin
esptool.py v2.1
Connecting.....
Chip is ESP32D0WDQ6 (revision 1)
Enabling default SPI flash mode...
Configuring flash size...
Auto-detected Flash size: 4MB
Erasing flash...
Compressed 982832 bytes to 609724...
Took 2.43s to erase flash block
Wrote 982832 bytes (609724 compressed) at 0x00001000 in 62.0 seconds (effective 126.8 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting...
I try to observe what happen on the USB and there is a message which coming periodicaly
But I already do that and it doesn't work.minicom -D /dev/ttyUSB0
FAT filesystem appears to be corrupted. If you had important data there, you
may want to make a flash snapshot to try to recover it. Otherwise, perform
factory reprogramming of MicroPython firmware (completely erase flash, followed
by firmware programming).
Do you have any idea