Skip to content

Commit ba7fd1e

Browse files
author
brentru
committed
add miniesptool for nina fw
1 parent 0362c36 commit ba7fd1e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

examples/miniesptool_esp32nina.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import time
2+
import board
3+
import busio
4+
from digitalio import DigitalInOut, Direction # pylint: disable=unused-import
5+
import adafruit_miniesptool
6+
7+
print("ESP32 Nina-FW")
8+
9+
uart = busio.UART(board.TX, board.RX, baudrate=115200, timeout=1)
10+
resetpin = DigitalInOut(board.D5)
11+
gpio0pin = DigitalInOut(board.D6)
12+
13+
esptool = adafruit_miniesptool.miniesptool(uart, gpio0pin, resetpin,
14+
flashsize=4*1024*1024)
15+
esptool.sync()
16+
17+
print("Synced")
18+
print("Found:", esptool.chip_name)
19+
if esptool.chip_name != "ESP32":
20+
raise RuntimeError("This example is for ESP32 only")
21+
esptool.baudrate = 912600
22+
print("MAC ADDR: ", [hex(i) for i in esptool.mac_addr])
23+
24+
# Note: Make sure to use the LATEST nina-fw binary release!
25+
esptool.flash_file("ninafw.bin")
26+
27+
esptool.reset()
28+
time.sleep(0.5)

0 commit comments

Comments
 (0)