Skip to content

Commit d5fbba8

Browse files
authored
Merge pull request #10 from brentru/add-nina-fw-esptool
Adding script for flashing Nina-FW on ESP32
2 parents 0362c36 + c431353 commit d5fbba8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

examples/miniesptool_esp32nina.py

+28
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("NINA_W102-1.3.1.bin",0x0,'3f9d2765dd3b7b1eab61e1eccae73e44')
26+
27+
esptool.reset()
28+
time.sleep(0.5)

0 commit comments

Comments
 (0)