Skip to content

Commit 536249e

Browse files
committed
README: Add the file README.md with build instructions.
This is for both the NINAW10 firmware and the esp_hosted firmware. Signed-off-by: robert-hh <[email protected]>
1 parent ab3b2aa commit 536249e

File tree

1 file changed

+167
-0
lines changed

1 file changed

+167
-0
lines changed

micropython/espflash/README.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
Instructions on building the NINAW10 and esp_hosted firmware
2+
3+
# Building the NINAW10 firmware
4+
5+
The NINAW10 firmware only works with classic ESP32 devices. No support
6+
for newer models like ESP32C3.
7+
8+
## Get the NINAW10 Arduino source code
9+
10+
The link is https://github.com/arduino/nina-fw.git.
11+
12+
## Get the ESP32 development environment.
13+
14+
Follow the instructions in the README.md document of the NINA firmware.
15+
The NINA firmware needs esp-idf v3.3.1 up to v3.3.4. After switching
16+
to the esp-idf version, run
17+
18+
./install.sh
19+
git submodule sync;git submodule update --init
20+
21+
in the esp-idf directory.
22+
23+
## Check the SPI and UART pins.
24+
25+
Change SPI pins at the bottom of this file:
26+
nina-fw-1.5.0-Arduino/arduino/libraries/SPIS/src/SPIS.cpp
27+
28+
Change UART pins at this file:
29+
nina-fw-1.5.0-Arduino/main/sketch.ino.cpp
30+
31+
The respective pin assignments can be found below in the second table.
32+
The only difference between the Arduino Airlift and NINAW102 module
33+
is for the RTS/MOSI pin. If you use a custom ESP32 device and want to
34+
use different pins, you can change the pin numbers as needed.
35+
36+
## Build the firmware
37+
38+
Call "make". The combined firmware file will be "NINA_W102.bin". This
39+
firmware can be loaded to the target module using e.g. espflash.py.
40+
41+
42+
# Building the esp-hosted firmware
43+
44+
The esp-hosted firmware should work with all ESP32 modules. Tested with
45+
a ESP32 classic and a ESP32C3.
46+
47+
## Get the esp-hosted source code
48+
49+
The source code repository is at:
50+
51+
https://github.com/espressif/esp-hosted.git
52+
53+
The code for the esp-hosted network adapter is at:
54+
55+
esp_hosted_fg/esp/esp_driver
56+
57+
## Get the ESP32 development environment.
58+
59+
Follow the instructions in the README.md of micropython/ports/esp32.
60+
61+
./install.sh
62+
git submodule sync;git submodule update --init
63+
64+
in the esp-idf directory.
65+
66+
## Check the SPI and UART pins.
67+
68+
The SPI pins are defined in the file:
69+
70+
esp_hosted_fg/esp/esp_driver/network_adapter/main/spi_slave_api.c
71+
72+
The SPI settings used for the airlift module with ESP32 are:
73+
74+
#define GPIO_MOSI 14
75+
#define GPIO_MISO 23
76+
#define GPIO_SCLK 18
77+
#define GPIO_CS 5
78+
79+
The UART pins for bluetooth are defined in the file:
80+
81+
esp_hosted_fg/esp/esp_driver/network_adapter/main/slave_bt.h
82+
83+
The UART settings used for the airlift module with ESP32 are:
84+
85+
#define BT_TX_PIN 1
86+
#define BT_RX_PIN 3
87+
#define BT_RTS_PIN 14
88+
#define BT_CTS_PIN 23
89+
90+
The respective pin assignments can be found below in the second table.
91+
The only difference between the Arduino Airlift and NINAW102 module
92+
is for the RTS/MOSI pin. If you use a custom ESP32 device and want to
93+
use different pins, you can change the pin numbers as needed.
94+
95+
## Build the firmware
96+
97+
Build the firmware using:
98+
99+
idf.py build
100+
101+
Create the combined firmware with the script:
102+
103+
#!/usr/bin/env python
104+
105+
import sys;
106+
107+
booloaderData = open("build/bootloader/bootloader.bin", "rb").read()
108+
partitionData = open("build/partition_table/partition-table.bin", "rb").read()
109+
otaData = open("build/ota_data_initial.bin", "rb").read()
110+
network_adapterData = open("build/network_adapter.bin", "rb").read()
111+
112+
# calculate the output binary size, app offset
113+
outputSize = 0x10000 + len(network_adapterData)
114+
if (outputSize % 1024):
115+
outputSize += 1024 - (outputSize % 1024)
116+
117+
# allocate and init to 0xff
118+
outputData = bytearray(b'\xff') * outputSize
119+
120+
# copy data: bootloader, partitions, app
121+
for i in range(0, len(booloaderData)):
122+
outputData[0x1000 + i] = booloaderData[i]
123+
124+
for i in range(0, len(partitionData)):
125+
outputData[0x8000 + i] = partitionData[i]
126+
127+
for i in range(0, len(otaData)):
128+
outputData[0xd000 + i] = otaData[i]
129+
130+
for i in range(0, len(network_adapterData)):
131+
outputData[0x10000 + i] = network_adapterData[i]
132+
133+
outputFilename = "esp_hosted_airlift.bin"
134+
if (len(sys.argv) > 1):
135+
outputFilename = sys.argv[1]
136+
137+
# write out
138+
with open(outputFilename,"w+b") as f:
139+
f.seek(0)
140+
f.write(outputData)
141+
142+
The combined firmware file will be "esp_hosted_airlift.bin". This
143+
file can be loaded to the target module using e.g. espflash.py.
144+
145+
146+
# NINAW10 and esp-hosted pins assignments
147+
148+
Mapping between firmware signal names and ESP32 pins for the NINA
149+
firmware and esp_hosted firmware
150+
151+
======== ========== ======== ======= =======
152+
NINAW10 esp_hosted NINA Airlift Airlift
153+
Name Name W102 pin Name pin
154+
======== ========== ======== ======= =======
155+
MOSI MOSI 12 MOSI 14
156+
MISO MISO 23 MISO 23
157+
SCK SCK 18 SCK 18
158+
GPIO1/CS CS 5 CS 5
159+
ACK HANDSHAKE 33 Busy 33
160+
RESET RESET EN Reset EN
161+
GPIO0 DATAREADY 0 GP0 0
162+
TX TX 1 TX 1
163+
RX TX 3 RX 3
164+
RTS MOSI/RTS 12 - 14
165+
CTS CTS 33 - 33
166+
======== ========== ======== ======= =======
167+

0 commit comments

Comments
 (0)