7
7
8
8
print ("ESP32 mini prog" )
9
9
10
-
11
-
12
- uart = busio .UART (board .TX , board .RX , baudrate = 115200 , timeout = 5 )
13
10
resetpin = DigitalInOut (board .RTS )
14
11
gpio0pin = DigitalInOut (board .DTR )
15
12
resetpin .direction = Direction .OUTPUT
19
16
gpio0pin .value = 1
20
17
21
18
import adafruit_sdcard , storage
22
- try :
23
- spi = busio .SPI (board .SCK , board .MOSI , board .MISO )
24
- cs = DigitalInOut (board .xSDCS )
25
- sdcard = adafruit_sdcard .SDCard (spi , cs )
26
- vfs = storage .VfsFat (sdcard )
27
- storage .mount (vfs , "/sd" )
28
- SD_IN = True
29
- except OSError :
30
- SD_IN = False
31
- print ('\n ---- No SD card found, proceeding without it ----\n ' )
32
- pass
19
+
20
+ spi = busio .SPI (board .SCK , board .MOSI , board .MISO )
21
+ cs = DigitalInOut (board .xSDCS )
22
+ sdcard = adafruit_sdcard .SDCard (spi , cs )
23
+ vfs = storage .VfsFat (sdcard )
24
+ storage .mount (vfs , "/sd" )
33
25
34
26
def print_directory (path , tabs = 0 ):
35
27
for file in os .listdir (path ):
@@ -53,10 +45,8 @@ def print_directory(path, tabs=0):
53
45
if isdir :
54
46
print_directory (path + "/" + file , tabs + 1 )
55
47
56
- print_directory ("/sd" )
57
-
58
48
time .sleep (0.5 )
59
-
49
+ uart = busio . UART ( board . TX , board . RX , baudrate = 115200 , timeout = 100 )
60
50
esptool = adafruit_miniesptool .miniesptool (uart , gpio0pin , resetpin , flashsize = 4 * 1024 * 1024 )
61
51
esptool .debug = True
62
52
time .sleep (0.5 )
@@ -67,13 +57,13 @@ def print_directory(path, tabs=0):
67
57
print ("Found:" , esptool .chip_name )
68
58
if esptool .chip_name != "ESP32" :
69
59
raise RuntimeError ("for ESP32 only" )
70
- # esptool.baudrate = 912600
60
+ esptool .baudrate = 912600
71
61
print ("MAC ADDR: " , [hex (i ) for i in esptool .mac_addr ])
72
- esptool .flash_file ('/sd/MicroPython.bin' , 0x10000 )
73
62
74
63
esptool .flash_file ('/sd/bootloader.bin' , 0x1000 )
75
64
esptool .flash_file ('/sd/phy_init_data.bin' , 0xf000 )
76
65
esptool .flash_file ('/sd/partitions_mpy.bin' , 0x8000 )
66
+ esptool .flash_file ('/sd/MicroPython.bin' , 0x10000 )
77
67
78
68
esptool .reset ()
79
- time .sleep (0.5 )
69
+ time .sleep (0.5 )
0 commit comments