Skip to content

Commit 1f69e92

Browse files
committed
mimxrt/docs: Extend the documentation for WLAN and BLE.
Inluding instructions for connecting external modules and uploading the WLAN/BLE firmware. Signed-off-by: robert-hh <robert@hammelrath.com>
1 parent 4480e83 commit 1f69e92

File tree

3 files changed

+257
-4
lines changed

3 files changed

+257
-4
lines changed

docs/mimxrt/general.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,21 @@ The following boards are supported by the port:
2525
- MIMXRT1050-EVK
2626
- MIMXRT1060-EVK
2727
- MIMXRT1064-EVK
28+
- MIMXRT1170-EVK
2829
- Teensy 4.0
2930
- Teensy 4.1
31+
- Olimex RT1010py
32+
- Seeed Arch Mix
33+
- Adafruit Metro M7
3034

3135
Supported MCUs
3236
--------------
3337

3438
+-------------+--------------------+-------------------------+
3539
| Product | CPU | Memory |
3640
+=============+====================+=========================+
41+
| i.MX RT1171 | Cortex-M7 @960 MHz | 2 MB SRAM |
42+
+-------------+--------------------+-------------------------+
3743
| i.MX RT1064 | Cortex-M7 @600 MHz | 1 MB SRAM, 4 MB Flash |
3844
+-------------+--------------------+-------------------------+
3945
| i.MX RT1061 | Cortex-M7 @600 MHz | 1 MB SRAM |
@@ -71,8 +77,8 @@ operating modes, internal functioning, etc.
7177
For your convenience, a few technical specifications are provided below:
7278

7379
* Architecture: ARM Cortex M7
74-
* CPU frequency: up to 600MHz
75-
* Total RAM available: up to 1 MByte (see table)
80+
* CPU frequency: up to 960MHz
81+
* Total RAM available: up to 2 MByte (see table)
7682
* BootROM: 96KB
7783
* External FlashROM: code and data, via SPI Flash; usual size 2 - 16 MB
7884
Some boards provide additional external RAM and SPI flash.

docs/mimxrt/quickref.rst

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ working with this board it may be useful to get an overview of the microcontroll
1818
general.rst
1919
tutorial/intro.rst
2020
pinout.rst
21+
wlan_pinout.rst
2122

2223

2324
Installing MicroPython
@@ -519,8 +520,8 @@ DHT modules may already have one.
519520
Ethernet driver
520521
---------------
521522

522-
All MIMXRT boards except the MIMXRT1011 based boards and Teensy 4.0 support
523-
Ethernet. Example usage::
523+
All MIMXRT boards except the MIMXRT101x based boards and Teensy 4.0 support
524+
Ethernet. Example usage::
524525

525526
import network
526527

@@ -540,6 +541,62 @@ port and LAN(1) for the 1G port.
540541

541542
For details of the network interface refer to the class :ref:`network.LAN <network.LAN>`.
542543

544+
WLAN
545+
----
546+
547+
In addition to Ethernet, some boards can be combined with an ESP32 based
548+
WLAN module to support WLAN connectivity. WLAN is then another class
549+
of the the :mod:`network` module::
550+
551+
import network
552+
553+
wlan = network.WLAN(network.STA_IF) # create station interface
554+
wlan.active(True) # activate the interface
555+
wlan.scan() # scan for access points
556+
wlan.isconnected() # check if the station is connected to an AP
557+
wlan.connect('ssid', 'key') # connect to an AP
558+
wlan.config('mac') # get the interface's MAC address
559+
wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
560+
561+
ap = network.WLAN(network.AP_IF) # create access-point interface
562+
ap.active(True) # activate the interface
563+
ap.config(ssid='ESP-AP') # set the SSID of the access point
564+
565+
A useful function for connecting to your local WiFi network is::
566+
567+
def do_connect():
568+
import network
569+
wlan = network.WLAN(network.STA_IF)
570+
wlan.active(True)
571+
if not wlan.isconnected():
572+
print('connecting to network...')
573+
wlan.connect('ssid', 'key')
574+
while not wlan.isconnected():
575+
pass
576+
print('network config:', wlan.ifconfig())
577+
578+
Once the network is established the :mod:`socket <socket>` module can be used
579+
to create and use TCP/UDP sockets as usual, and the ``requests`` module for
580+
convenient HTTP requests.
581+
582+
Supported boards are:
583+
584+
- ADAFRUIT_METRO_M7_AIRLIFT: WLAN adapter built-in
585+
- MIMXRT1010_EVK with e.g. the Adafruit Airlift Uno board
586+
- MIMXRT1015_EVK with e.g. the Adafruit Airlift Uno board
587+
- OLIMEX RT1010py
588+
- MIMXRT1020_EVK with e.g. the Adafruit Airlift Uno board
589+
- MIMXRT1050_EVK with e.g. the Adafruit Airlift Uno board
590+
- Seeed Arch Mix
591+
- Teensy 4.0 with e.g. Adafruit Feather Airlift + Teensy/Feather adapter
592+
- Teensy 4.1 with e.g. Adafruit Feather Airlift + Teensy/Feather adapter
593+
594+
More boards may support it, but could not be tested yet. As external
595+
WLAN module, any ESP32 based breakout can be used. It has to be loaded
596+
with the proper firmware and wired up accordingly. For the wiring
597+
scheme, see the :ref:`WLAN connection scheme <mimxrt_wlan_pinout>`.
598+
599+
543600
Transferring files
544601
------------------
545602

docs/mimxrt/wlan_pinout.rst

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
.. _mimxrt_wlan_pinout:
2+
3+
Managing external WLAN/BLE adapters
4+
===================================
5+
6+
Connection scheme for the i.MXRT WLAN adapters
7+
----------------------------------------------
8+
9+
Mapping between the NINA/esp_hosted signals and board pins by name.
10+
11+
======== ========== ======= ======== ====== ====== ======= ========
12+
NINAW10 esp_hosted Airlift MIMXRT Teensy OLIMEX Seeed METRO M7
13+
Name Name Name 10xx_EVK 4.x RT1010 ArchMix Airlift
14+
======== ========== ======= ======== ====== ====== ======= ========
15+
MOSI/RTS MOSI MOSI D11 D11 A2 J4-14 MOSI
16+
MISO MISO MISO D12 D12 A1 J4-13 MISO
17+
SCK SCK SCK D13 D13 A4 J4-15 SCK
18+
CS CS CS D10 D5 A3 J4-12 ESP_CS
19+
ACK/CTS HANDSHAKE Busy D7 D9 SCL2 J4-11 ESP_BUSY
20+
RESET RESET Reset D5 D6 SDA2 J4-10 ESP_RESET
21+
GPIO0 DATAREADY GP0 D6 D10 (*) J4-09 ESP_GP0
22+
SPI# 0 0 0 0 0
23+
TX TX TX D0 D0 D8 J4-06 D0
24+
RX RX RX D1 D1 D7 J4-07 D1
25+
RTS MOSI/RTS RTS D11 D11 A2 J4-14 MOSI
26+
CTS CTS CTS D12 D12 SCL2 J4-13 ESP_BUSY
27+
UART# 1 1 2 3 1
28+
======== ========== ======= ======== ====== ====== ======= ========
29+
30+
(*) GPIO0 of the WiFi module can be shared e.g. with SCK if they are
31+
decoupled with a resistor from SCK (Host) to the GPIO input module.
32+
33+
Mapping between firmware signal names and ESP32 pins for the NINA firmware
34+
and esp_hosted firmware
35+
36+
======== ========== ======== ======= =======
37+
NINAW10 esp_hosted NINA Airlift Airlift
38+
Name Name W102 pin Name pin
39+
======== ========== ======== ======= =======
40+
MOSI MOSI 12 MOSI 14
41+
MISO MISO 23 MISO 23
42+
SCK SCK 18 SCK 18
43+
GPIO1/CS CS 5 CS 5
44+
ACK HANDSHAKE 33 Busy 33
45+
RESET RESET EN Reset EN
46+
GPIO0 DATAREADY 0 GP0 0
47+
TX TX 1 TX 1
48+
RX TX 3 RX 3
49+
RTS MOSI/RTS 12 - 14
50+
CTS CTS 33 - 33
51+
======== ========== ======== ======= =======
52+
53+
Mapping between the NINA/esp_hosted signals and adapter pins by name.
54+
55+
======== ========== ======= ========= ======== ========= ==========
56+
NINAW10 esp_hosted Airlift ItsyBitsy Feather METRO M7 Airlift
57+
Name Name Name Add-on Add-on Airlift Uno Shield
58+
======== ========== ======= ========= ======== ========= ==========
59+
MOSI MOSI MOSI MOSI MOSI MOSI MOSI
60+
MISO MISO MISO MISO MISO MISO MISO
61+
SCK SCK SCK SCK SCK SCK SCK
62+
GPIO1/CS CS CS ECS ESPCS ESP_CS CS
63+
ACK HANDSHAKE Busy EBSY ESPBUSY ESP_BUSY BUSY
64+
RESET RESET Reset RST ESPRESET ESP_RESET RST
65+
GPIO0 DATAREADY GP0 GPIO0 ESPGPIO0 ESP_GP0 G0
66+
TX TX TX ETX ESPTX ESP_TX TX
67+
RX RX RX ERX ESPRX ESP_RX RX
68+
======== ========== ======= ========= ======== ========= ==========
69+
70+
Signals required for WiFi:
71+
72+
- NinaW10: MISO/MOSI/SCK (SPI), CS, Busy (ACK), Reset
73+
- esp_hosted: MISO/MOSI/SCK (SPI), CS, Handshake, Dataready, Reset
74+
75+
Signals required for Bluetooth:
76+
77+
- NinaW10: RX/TX (UART), RTS (MOSI), CS, RESET
78+
- esp_hosted: RX/TX (UART), RTS (MOSI), CS, RESET
79+
80+
CTS seems not to be used, but specified.
81+
82+
Signals required for NINA/esp_hosted firmware upload:
83+
84+
- RX/TX (UART), GPIO0, Reset.
85+
86+
If the hardware supports it, pull RESET low (!). That keeps the
87+
ESP32 with the NINA/esp_hosted firmware silent and at low power
88+
when not being used.
89+
90+
91+
.. _mimxrt_wlan_firmware_upload:
92+
93+
Instructions for WLAN/BLE firmware upload ESP32 module
94+
------------------------------------------------------
95+
96+
The NINA firmware in the NINA module has to be updated for use with MicroPython. That can be done
97+
using MicroPython and two small Python scripts.
98+
99+
The firmware binaries are available at
100+
https://github.com/micropython/micropython-lib/tree/master/micropython/espflash
101+
There are the firmware files available for different esp32 modules.
102+
103+
1. Adafruit Airlift modules with NINA firmware: NINA_FW_v1.5.0_Airlift.bin.
104+
2. Adafruit Airlift modules with esp_hosted firmware: esp_hosted_airlift.bin
105+
3. Arduino Nano RP2040 connect: NINA_FW_v1.5.0_W102.bin
106+
107+
For the mimxrt boards with i.MX RT 101x MCU, you need the file NINA_FW_v1.5.0_Airlift.bin, for
108+
all other boards esp_hosted_airlift.bin.
109+
110+
For firmware upload, the following connections to the WiFi module are required:
111+
112+
- Pin Reset (as above)
113+
- Pin GPIO0
114+
- UART RX
115+
- UART TX
116+
117+
The GPIO pins and UART device id varies between boards. See the tables above.
118+
At the Adafruit Metro M7 board, the UART is UART(1), and the Pin names
119+
for reset and GPIO0 are ESP_RESET and ESP_GPIO0.
120+
The firmware can be uploaded, using the espflash.py module, a short script
121+
using espflash.py and mpremote. espflash.py is available at
122+
https://github.com/micropython/micropython-lib/tree/master/micropython/espflash.
123+
This place also holds the example script.::
124+
125+
import espflash
126+
from machine import Pin
127+
from machine import UART
128+
import sys
129+
sys.path.append("/flash")
130+
131+
reset = Pin("ESP_RESET", Pin.OUT)
132+
gpio0 = Pin("ESP_GPIO0", Pin.OUT)
133+
uart = UART(0, 115200, timeout=350)
134+
135+
md5sum = b"b0b9ab23da820a469e597c41364acb3a"
136+
path = "/remote/NINA_FW_v1.5.0_Airlift.bin"
137+
138+
esp = espflash.ESPFlash(reset, gpio0, uart)
139+
# Enter bootloader download mode, at 115200
140+
esp.bootloader()
141+
# Can now change to higher/lower baud rate
142+
esp.set_baudrate(921600)
143+
# Must call this first before any flash functions.
144+
esp.flash_attach()
145+
# Read flash size
146+
size = esp.flash_read_size()
147+
# Configure flash parameters.
148+
esp.flash_config(size)
149+
# Write firmware image from internal storage.
150+
esp.flash_write_file(path)
151+
# Compares file and flash MD5 checksum.
152+
esp.flash_verify_file(path, md5sum)
153+
# Resets the ESP32 chip.
154+
esp.reboot()
155+
156+
The script shows the set-up for the Metro M7 board.
157+
The md5sum is the one of the WiFi firmware. It may change and
158+
can be recalculated using e.g. the Linux *md5sum* command. It is used to
159+
verify the firmware upload. To upload the firmware, place the firmware
160+
and the above script (let's call it ninaflash.py) into the same directory
161+
on your PC, and run the command::
162+
163+
mpremote connect <port> mount . run ninaflash.py
164+
165+
After a while, the upload will start. A typical start sequence looks like::
166+
167+
Local directory . is mounted at /remote
168+
Failed to read response to command 8.
169+
Failed to read response to command 8.
170+
Changing baudrate => 921600
171+
Flash attached
172+
Flash size 2.0 MBytes
173+
Flash write size: 1310720 total_blocks: 320 block size: 4096
174+
Writing sequence number 0/320...
175+
Writing sequence number 1/320...
176+
Writing sequence number 2/320...
177+
Writing sequence number 3/320...
178+
Writing sequence number 4/320...
179+
....
180+
....
181+
Writing sequence number 317/320...
182+
Writing sequence number 318/320...
183+
Writing sequence number 319/320...
184+
Flash write finished
185+
Flash verify: File MD5 b'b0b9ab23da820a469e597c41364acb3a'
186+
Flash verify: Flash MD5 b'b0b9ab23da820a469e597c41364acb3a'
187+
Firmware verified.
188+
189+
The initial messages *Failed to read response to command 8.*
190+
can be ignored.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy